-
-
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
[Bug]: jest fails when @cspot/source-map-support and yarn 2+ pnp are involved. #12366
Comments
Hi, replying to say that I'm following along and will be happy to answer any questions. Feel free to mention me directly. |
Adding a bit more context: In the highlighted snippet of jest code above:
...it appears to be emulating what would happen if "source-map-support" were, internally, to require itself. That is, a file within "@cspotcode/source-map-support" redirects Given the above, I'm wondering what is the best path forward. Think my proposed patch solves the problem, but I don't understand why jest's current logic is necessary. |
|
I halfway understand what you're saying. As a more concrete follow-up question to hopefully aid my understanding: Is my proposed fix acceptable? If it's not, what rules is it breaking? |
Yeah, your fix seems correct, we should just delete line 217. Not sure why it was ever added... |
PR welcome :grin\ |
OK, I can do one tomorrow. |
ideally with some integration test that fails without the change. Possibly just the reproduction used in the OP |
Naturally |
Awesome, thank you both! |
@francisu ping 🙂 |
Sounds good 👍 |
Interestingly enough I had this error in CI (Ubuntu), but it worked fine locally (Windows). Added this to my packageExtensions:
'@cspotcode/source-map-support@*':
dependencies:
source-map-support: '*' |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
@francisu ping 😀 |
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. |
Version
27.5.1
Steps to reproduce
Use this repo: https://github.com/noahnu/repro-source-map-error (h/t @noahnu for making this)
yarn install
yarn ts-node --transpile-only $(yarn bin jest)
Expected behavior
Test should pass.
Actual behavior
Additional context
The original issue is: cspotcode/node-source-map-support#35, but it seems to be a Jest problem.
Here is the a patch that fixes it (thanks to @cspotcode )
Replace this code:
https://github.com/facebook/jest/blob/3a85065fe5604655e1337ffc1631f9999722c821/packages/jest-runner/src/runTest.ts#L213-L219
with:
This might be related to:
#8930
#11453
Environment
The text was updated successfully, but these errors were encountered: