-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
ts-node not found with TS config file and yarn 2 PNP strict mode + workspaces #11751
Comments
Thanks for posting thorough reproduction steps, @blutorange. =) I'm admittedly not deeply familiar with PnP, and as such don't have much to add; but judging from the errors and require stack trace it does seem like the preceding packages in the chain might also have to provide I would defer to @SimenB's wisdom on this (and to what extent Jest wants to support strict package managers) |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
I updated the example repo with the latest versions of yarn and jest. The issue still occurs. Since yarn is getting more usage, it would be great if this could be resolved. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
Jest supports writing configuration files in TypeScript, but it does not work when using Yarn 2 PNP strict mode combined with workspaces.
As far as I could find out: Yarn PNP strict mode requires that all packages declare the modules they are using.
ts-config
declarests-node
as an optional peer dependency, but it seems some other jest packages do not. As a workaround, I can patch the packages via the following entries is.yarnrc.yml
To Reproduce
Seems to happen when (see git repo below):
common
package.json
with aworkspace
entryjest.config.ts
config file written in TypeScript__test__/util.spec.ts
test written in TypeScriptjest
,ts-jest
,ts-node
,tslib
,typescript
are installed asdevDependencies
.Running
jest
(yarn workspace common run test
) now results in the following error:Expected behavior
Jest runs successfully, yarn can load
ts-node
.Link to repl or repo (highly encouraged)
https://github.com/blutorange/bug-jest-ts-config-with-yarn-pnp-strict
If you now open
.yarnrc.yml
, uncomment thepackageExtensions
section, and runyarn install
followed byyarn workspace common run test
again, it should run the test successfully.The text was updated successfully, but these errors were encountered: