You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FAIL test/a.test.mjs
● Test suite failed to run
Unexpected export statement in CJS module.
at @:1:8
at @:1:8
at throwIfExportStatement (node_modules/cjs-module-lexer/lexer.js:1189:9)
at parseSource (node_modules/cjs-module-lexer/lexer.js:155:13)
at parseCJS (node_modules/cjs-module-lexer/lexer.js:43:5)
at Array.forEach (<anonymous>)
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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Version
28.1.3
Steps to reproduce
yarn install
yarn test
Expected behavior
All tests pass
Actual behavior
One test fails
Additional context
This appears to be because this code uses
esmConditions
rather thancjsConditions
, so the resolver returns an ESM module for arequire()
which then fails to parse as CJS.https://github.com/facebook/jest/blob/7d8d01c4854aa83e82cc11cefdd084a7d9b8bdfc/packages/jest-runtime/src/index.ts#L795-L797
Changing that to
cjsConditions
makes the test pass.Environment
System: OS: Linux 5.18 Debian GNU/Linux bookworm/sid CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz Binaries: Node: 16.17.0 - /usr/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.15.0 - /usr/bin/npm npmPackages: jest: ^28.1.3 => 28.1.3
The text was updated successfully, but these errors were encountered: