Open amattu2 opened 1 month ago
Currently, jest does not support esm syntax by default. If you want to test esm module
, update the test script like the following code:
{
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
}
More detail can check: https://jestjs.io/docs/ecmascript-modules
Describe the bug
After updating from v2.16.0 to v3.1.0, no Jest test files will execute.
To Reproduce
This can be reproduced using the base create-react-app project, adding the usehooks-ts dependency, and then executing the base test case after importing usehooks-ts.
Setup Project
Add usehooks-ts Dependency
Import the package
Modify the App.tsx file to import usehooks-ts. The hook doesn't matter, this example uses
useBoolean
Run Tests
The tests will now fail. If you comment out the import, it works as expected.
Expected behavior
Upgrading to/beyond
v3.0.0
should not impact existing projects or the execution of tests using Jest.Additional context
Likely related to #502