Jest compatibility?
See original GitHub issueHi! Thanks for sharing this project! I’m trying to use it with Jest, and running into trouble:
myproject-consumer-portal feature/test-architecture ✗ 3h26m △ ➜ yarn test
yarn test v0.24.6
$ jest
FAIL src/modules/client/ducks/flow/reducers.spec.js
● Test suite failed to run
/Users/brandon/code/myproject-consumer-portal/src/modules/client/ducks/flow/reducers.spec.js: Unexpected token import
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at PluginPass.CallExpression (node_modules/babel-plugin-webpack-alias/build/index.js:39:28)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.607s
Ran all test suites.
error Command failed with exit code 1.
I’m digging into the source trying to figure out how to work around it, but I don’t have any good leads yet. If anyone has ideas, I’d love to hear them! 😃
My .babelrc
:
{
"presets": ["react", "es2015", "stage-1"],
"plugins": [
"add-module-exports",
"jsx-display-if",
"transform-class-properties",
"transform-object-rest-spread",
[ "babel-plugin-webpack-alias", { "config": "./tools/webpack/webpack.resolve.babel.js", "findConfig": true } ],
"styletron-react"
]
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Jest 28: Shedding weight and improving compatibility
Jest 28 is finally here, and it comes with some long requested features such as support for sharding a test run across multiple...
Read more >Jest Versions
Current version (Stable). Latest stable version of Jest ; Latest version. Here you can find the latest unreleased documentation and code. ; Past...
Read more >Getting Started - Jest
You just successfully wrote your first test using Jest! This test used expect and toBe to test that two values were exactly identical....
Read more >From v28 to v29 - Jest
Compatibility. The supported Node versions are 14.15, 16.10, 18.0 and above. Snapshot format. As announced in the Jest 28 blog post, ...
Read more >Configuring Jest
That is caused by backward compatibility reasons and process.on('unhandledRejection', callback) signature, but that usually should not be a ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I ended up ditching aliases altogether, and going with
lerna
and a monorepo structure. 😃I wound up using
moduleNameMapper
in the package.json: