-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
Description
Here's my config:
// karma.conf.js
module.exports = function (config) {
config.set({
frameworks: ['mocha', 'chai'],
plugins: [
'karma-esbuild',
'karma-mocha',
'karma-chai',
'karma-chrome-launcher',
],
files: ['packages/*/test/**/*.test.+(ts|tsx)'],
preprocessors: {
'**/*.+(ts|tsx)': 'esbuild',
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
browsers: ['Chrome'],
autoWatch: false,
singleRun: true,
concurrency: Infinity,
esbuild: {
tsconfig: 'tsconfig.spec.json',
inject: ['./karma-esbuild-react.js'],
},
})
}
// karma-esbuild-react.js
import React from 'react';
import React from 'react';
is not being injected at all. Also, changing tsconfig
to anything else has no effect.
Uncaught ReferenceError: React is not defined
at /path/to/MyComponent.tsx:22:11
The documentation says that this is how you pass options to esbuild, but it appears not to be the case.