-
Notifications
You must be signed in to change notification settings - Fork 507
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
yarn 2 berry: tsdx tried to access babel-jest, but it isn't declared in its dependencies; #688
Comments
So It's a bit weird that Berry would punish TSDX also doesn't have support for Berry yet -- there is #458 for that -- I'd be surprised if this were the only issue encountered while using Berry. I'm not sure all the dependencies support it either. |
For a temporary resolution, you can switch to pnp loose mode. Set |
so far I was able to manage it to get it work together with yarn 2 in my monorepo: https://github.com/upsetjs/upsetjs. It required some customization (like the rollup-plugin-pnp-resolve for rollup: https://github.com/upsetjs/upsetjs/blob/master/packages/model/tsdx.config.js) but doable. |
If you look at the dependency tree it's really just luck/hoisting that makes
@agilgur5 There is no guarantee you'll actually get the same version as jest has in its tree without declaring it, there might be some other dependency that declares
From running |
Per my previous comment, Jest itself does the same for its default config. It's officially documented behavior, not luck.
The comment above and issue itself say that You're welcome to contribute that work if you want that integration to exist faster. |
In case this is helpful: I think https://nodejs.org/api/module.html#module_module_createrequire_filename |
What is tsdx's intended behavior when choosing a version of babel-jest? Jest's documentation says that projects are supposed to declare their own dependency on babel-jest, suggesting that users should not depend on a version being hoisted from jest's dependency tree: https://jestjs.io/docs/en/getting-started#using-babel I assume that tsdx intends to bundle its own copy of babel-jest to simplify end-user configuration. What is the intent if a project declares its own babel-jest dependency, with a different version than the one bundled by tsdx? |
Current Behavior
when using v0.13.2 with yarn 2 berry, I get the following error when running
tsdx test
see also:
tsdx/src/createJestConfig.ts
Line 12 in 3c65bdf
Expected behavior
all modules that are references using
require
orrequire.resolve
have to be part of the dependencies of the package.Suggested solution(s)
add
babel-jest
to the direct dependenciesAdditional context
Your environment
The text was updated successfully, but these errors were encountered: