JSX syntax extension is not currently enabled for Jest runner #58
Open
Description
Problem
It seems like the loader
I defined in my config is not being passed to Esbuild.
esbuild-runner.config.js
module.exports = {
debug: true,
esbuild: {
loader: { '.js': 'jsx' },
target: 'esnext',
},
type: 'transform', // I also tried bundle
};
Note: Dropped a
console.log
in this file, it is being loaded.
Jest config
{
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "esbuild-runner/jest"
}
}
Error Message
yarn run v1.22.17
$ jest spec/javascript/components/Accordion.test.js
RUNS spec/javascript/components/Accordion.test.js
✘ [ERROR] The JSX syntax extension is not currently enabled
/workspace/spec/javascript/components/Accordion.test.js:11:6:
11 │ <Accordion expanded={false}>
╵ ^
The esbuild loader for this file is currently set to "js" but it must be set to "jsx" to
FAIL spec/javascript/components/Accordion.test.js { '.js': 'jsx' }" to do that.
● Test suite failed to run
Transform failed with 1 error:
/workspace/spec/javascript/components/Accordion.test.js:11:6: ERROR: The JSX syntax extension is not currently enabled
at failureErrorWithLog (node_modules/esbuild/lib/main.js:1603:15)
at node_modules/esbuild/lib/main.js:1392:29
at node_modules/esbuild/lib/main.js:666:9
at handleIncomingPacket (node_modules/esbuild/lib/main.js:763:9)
at Socket.readFromStdout (node_modules/esbuild/lib/main.js:632:7)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.228 s
Ran all test suites matching /spec\/javascript\/components\/Accordion.test.js/i.
error Command failed with exit code 1.
Metadata
Assignees
Labels
No labels