typescript-jest-example
typescript-jest-example copied to clipboard
Bump jest version
I think these are the last versions that work properly with import
statements:
{
"@types/jest": "^26.0.0",
"jest": "^26.0.0",
"ts-jest": "^26.0.0"
}
If you bump this to v27 or higher you'll get:
Error [ERR_REQUIRE_ESM]: require() of ES Module ~/project/node_modules/wrap-ansi/index.js from ~/project/node_modules/jest-cli/node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in ~/project/node_modules/jest-cli/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (~/project/node_modules/jest-cli/node_modules/cliui/build/index.cjs:293:14)
at Object.<anonymous> (~/project/node_modules/jest-cli/node_modules/yargs/build/index.cjs:1:60678)
at Object.<anonymous> (~/project/node_modules/jest-cli/node_modules/yargs/index.cjs:5:30)
at _yargs (~/project/node_modules/jest-cli/build/run.js:30:39)
at buildArgv (~/project/node_modules/jest-cli/build/run.js:143:26)
at Object.run (~/project/node_modules/jest-cli/build/run.js:118:24)
at Object.<anonymous> (~/project/node_modules/jest-cli/bin/jest.js:16:17)
at Object.<anonymous> (~/project/node_modules/jest/bin/jest.js:12:3)
error Command failed with exit code 1.
Do you know if there's a way to fix this?