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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
ts-jest warns about babel-jest not installed when used in yarn 2 workspace #2749
Comments
Workaround: add the following to packageExtensions:
'ts-jest@*':
peerDependencies:
'babel-jest': '*' and rerun |
If adding Babel-jest to peer deps, it will make users who don鈥檛 use Babel-jest get the warning too. I think it鈥檚 just yarn 2 problem itself because yarn 1 doesn鈥檛 have this problem. |
It's not a yarn 2 problem (in it being a regression from yarn 1). PnP forces package.json files to be explicit about all of its dependencies. In this case, this is a correct error (that yarn 1 didn't check) that
"peerDependenciesMeta": {
"babel-jest": {
"optional": true
}
} |
ah ha i never use that optional before. PR is welcome :) |
馃悰 Bug Report
Yarn 2 has workspaces, where you have a top-level
package.json
, with subdirectories having their ownpackage.json
. If a workspace hasts-jest
andbabel-jest
installed, withbabelConfig
set,ts-jest
will warneven though it actually finds
babel-jest
correctly (ts-jest.log
shows "loaded module babel-jest" log).Doing some debugging, I printed out the error in
get-package-version.ts
and saw that it shows the usual Yarn 2 Pnp error:Looks like
ts-jest
just needs to addbabel-jest
to itspeerDependencies
list (docs).To Reproduce
Steps to reproduce the behavior:
mkdir repro && cd repro
yarn set version berry
yarn init
mkdir foo && touch foo/package.json
package.json
to add"private": true
and"workspaces": ["./foo"]
yarn workspace foo add jest ts-jest typescript babel-jest @babel/core @types/jest
jest.config.js
to enablets-jest
and turn onbabelConfig: true
Expected behavior
Warning should not appear.
Link to repo (highly encouraged)
Debug log:
envinfo
The text was updated successfully, but these errors were encountered: