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 with Cannot find module 'source-map-support'
when using pnpm
linker
#3741
Comments
Nevermind, I figured it out. The tests are run from the root workspace which didn't have the For some reason this worked with PnP and node_modules linkers but not in pnpm. |
Strike that, the internal error is here: Error: Cannot find module 'source-map' from '../../../node_modules/.store/source-map-support-npm-0.5.19-65b33ae61e/node_modules/source-map-support/source-map-support.js' the overflow is because this loop in jest repeats infinitely when (module.parent === module). Which it is in source-map-support. The underlying issue is that when falling back to native resolve: Jest resolves from the current working directory, rather than from the directory of the file. Which means in a pnpm-style install, you need to have both source-maps and source-map-support installed somewhere that native resolve can find them, which is why installing them at the root of your repo works. I think that means in order to be properly specified, jest should be setting source-maps and source-map-support as dependencies. I wonder why they don't resolve from the importer at right now? You also need to add |
This might have been fixed in Jest 28 via jestjs/jest#12706 |
Still having this issues with jest@^29.5.0 |
Yes still have this issue... Please advise.. |
Please create a new issue with a reproduction |
i ran into the same issue. Check your jest.config you probably have the wrong |
Self-service
Describe the bug
I'm currently trying to migrate from the PnP linker to pnpm. However,
jest
now fails every test with the following error:Both files exist on disk.
To reproduce
This seems to happen in a specific monorepo setup, so I'm not quite sure if this is a yarn issue or a jest issue or just an incorrect configuration. You can see it in action by
yarn
yarn test
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: