🐛 Bug Report
Yarn 2 has workspaces, where you have a top-level package.json, with subdirectories having their own package.json. If a workspace has ts-jest and babel-jest installed, with babelConfig set, ts-jest will warn
ts-jest[versions] (WARN) Module babel-jest is not installed. If you're experiencing issues, consider installing a supported version (>=27.0.0 <28.0.0-0).
even 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:
Error: ts-jest tried to access babel-jest, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: babel-jest (via "babel-jest")
Required by: ts-jest@virtual:cdc2a663889160479555b82f11958bfd85b7d15b045b5582042820fdf488eff146d80f22499fcddb05d9aac4969ca161c3fb96119d941ba1ca3ee741a319bc59#npm:27.0.3 (via .../.yarn/$$virtual/ts-jest-virtual-48f1fd0a1a/0/cache/ts-jest-npm-27.0.3-10e7dc0605-a63f3a8620.zip/node_modules/ts-jest/dist/utils/)
Looks like ts-jest just needs to add babel-jest to its peerDependencies 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
- Edit
package.json to add "private": true and "workspaces": ["./foo"]
yarn workspace foo add jest ts-jest typescript babel-jest @babel/core @types/jest
- Edit
jest.config.js to enable ts-jest and turn on babelConfig: true
- See warning appear
Expected behavior
Warning should not appear.
Link to repo (highly encouraged)
Debug log:
# content of ts-jest.log :
envinfo
System:
OS:
Node version:
Npm packages:
jest:
ts-jest:
typescript:
babel(optional):
🐛 Bug Report
Yarn 2 has workspaces, where you have a top-level
package.json, with subdirectories having their ownpackage.json. If a workspace hasts-jestandbabel-jestinstalled, withbabelConfigset,ts-jestwill warneven though it actually finds
babel-jestcorrectly (ts-jest.logshows "loaded module babel-jest" log).Doing some debugging, I printed out the error in
get-package-version.tsand saw that it shows the usual Yarn 2 Pnp error:Looks like
ts-jestjust needs to addbabel-jestto itspeerDependencieslist (docs).To Reproduce
Steps to reproduce the behavior:
mkdir repro && cd reproyarn set version berryyarn initmkdir foo && touch foo/package.jsonpackage.jsonto add"private": trueand"workspaces": ["./foo"]yarn workspace foo add jest ts-jest typescript babel-jest @babel/core @types/jestjest.config.jsto enablets-jestand turn onbabelConfig: trueExpected behavior
Warning should not appear.
Link to repo (highly encouraged)
Debug log:
envinfo