-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running jest with ES Modules on windows fails #9544
Comments
Oh, interesting! We run this on windows CI, odd it didn't pick it up... Does it work if you pass the full path through |
Unsure. Could be. On the node issue they replied that I need to put "file:///" at the start. Is that what your code does? (cant test at the moment) |
Yup, but I'm not sure if that function works without there being a |
Great, thanks @SimenB ! |
Thanks for reporting π |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
π Bug Report
I can't run jest with a project using ES Modules on windows
To Reproduce
Steps to reproduce the behavior:
β Would you like to use Jest when running "test" script in "package.json"? ... yes
β Choose the test environment that will be used for testing Β» node
β Do you want Jest to add coverage reports? ... no
β Automatically clear mock calls and instances between every test? ... no
I tried to do some debugging and found the cause. With a breakpoint in node_modules\jest-config\build\importMjs.js:16:29 we can see that this line is run:
var _default = specifier => import(specifier);
With a "specifier" value of
C:\prog\node\jestgrej\jest.config.mjs
. Doing imports of ES Modules with absolute paths doesn't work on windows. See this other issue I made: nodejs/node#31710A workaround would be to use relative imports.
./jest.config.mjs
would work in this case.Expected behavior
It should be able to start up and run some tests
envinfo
I guess this is related to #9430 . But I didn't see any mention of windows there.
The text was updated successfully, but these errors were encountered: