A clearer understanding of how babel-jest needs to be configured to avoid this problem -- it appears that tsdx can't find the module babel-jest... but it's listed as a dependency due tsdx when I run yarn why.
Additional context
The key point here is that my main branch works just fine, a feature branch breaks on this and it's unclear to me why. The only changes to dependencies were:
yarn test
yarn run v1.22.4
$ tsdx test --passWithNoTests --coverage
/Users/stephen.weiss/code/olo/expo-web-ui/node_modules/tsdx/dist/index.js:385
throw err;
^
Error: Cannot find module 'babel-jest'
Require stack:
- /Users/stephen.weiss/code/olo/expo-web-ui/node_modules/tsdx/dist/createJestConfig.js
- /Users/stephen.weiss/code/olo/expo-web-ui/node_modules/tsdx/dist/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.resolve (internal/modules/cjs/helpers.js:80:19)
at Object.createJestConfig (/Users/stephen.weiss/code/olo/expo-web-ui/node_modules/tsdx/dist/createJestConfig.js:7:35)
at /Users/stephen.weiss/code/olo/expo-web-ui/node_modules/tsdx/dist/index.js:388:73
at Sade.parse (/Users/stephen.weiss/code/olo/expo-web-ui/node_modules/sade/lib/index.js:189:56)
at Object.<anonymous> (/Users/stephen.weiss/code/olo/expo-web-ui/node_modules/tsdx/dist/index.js:462:6)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/stephen.weiss/code/olo/expo-web-ui/node_modules/tsdx/dist/createJestConfig.js',
'/Users/stephen.weiss/code/olo/expo-web-ui/node_modules/tsdx/dist/index.js'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn why babel-jest -R
yarn why v1.22.4
[1/4] 🤔 Why do we have the module "babel-jest"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "babel-jest@25.5.1"
info Reasons this module exists
- "tsdx#jest#@jest#core#jest-config" depends on it
- Hoisted from "tsdx#jest#@jest#core#jest-config#babel-jest"
✨ Done in 0.74s.
Current Behavior
When I run
yarn test
my code it now breaks.Expected behavior
I'd expect the test report to run successfully.
Suggested solution(s)
A clearer understanding of how
babel-jest
needs to be configured to avoid this problem -- it appears that tsdx can't find the modulebabel-jest
... but it's listed as a dependency duetsdx
when I runyarn why
.Additional context
The key point here is that my main branch works just fine, a feature branch breaks on this and it's unclear to me why. The only changes to dependencies were:
No changes to jest.config
Related question: https://github.com/jaredpalmer/tsdx/issues/688
Your environment