-
Notifications
You must be signed in to change notification settings - Fork 455
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-jest using wrong typescript version with yarn workspaces/monorepo (repro) #1333
Comments
Found a workaround: {
"private": true,
"workspaces": {
"packages": ["packages/*"],
"nohoist": ["**/ts-jest", "**/ts-jest/**"]
},
"scripts": {
"test": "yarn workspace test test"
}
} Adding the |
I agree at the moment ts-jest doesn’t support monorepo. However we are lack of experience with that so we need community help to implement it. |
close in favor of #1343 |
hi @andreialecu , I checked your repo and I don't get what do you expect ? Do you expect the test in your |
@ahnpnl If you clone the repo and run It's possible the bug is in |
Yes, that's the error, I explained in the comment above why that shouldn't happen. You can update the root package json to this: {
"private": true,
"workspaces": {
"packages": ["packages/*"],
"nohoist": ["**/ts-jest", "**/ts-jest/**"]
},
"scripts": {
"test": "yarn workspace test test"
}
} Run |
ok I got it now, so the error shouldn't happen because the |
i like the solution using |
@ahnpnl I looked briefly through the code and I see that Based on that, I suspect it's Unfortunately I'm not familiar with It's possible for example that this fixes it: jestjs/jest#9520 |
hmm i think it might be Tbh, I'm not sure the expected behavior is the correct behavior. In your repo, If you want to run specific a |
Workspace packages are supposed to be isolated. Dependencies are only hoisted for optimization purposes, so they do not get duplicated. Running Basically it runs the But I think you identified where the problem is. That |
Thanks 🙏 |
Issue :
I'm running into a blocking issue with ts-jest using yarn workspaces. I have multiple packages that define various typescript versions, and
ts-jest
seems to use the wrong one, rather than the one pinned inside each package.json.So for example, I'm using typescript 3.7 syntax in a package, but the main
node_modules
folder has typescript defined as version3.5.3
instead, andts-jest
seems to use that one instead of the one in the target package'snode_modules
which would correctly be 3.7.3.Expected behavior :
Should use the proper typescript version defined in the sub-package's package.json.
Debug log:
Notice how the log file also shows how it's getting typescript from the wrong location:
Minimal repo :
Repro at: https://github.com/andreialecu/tsjestrepro
The text was updated successfully, but these errors were encountered: