-
-
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
Subpath imports are not resolved #11100
Comments
@ljharb will this come at the same time as |
Hopefully, but it’s a bit unclear since subpath imports only work from inside a package context. |
Are subpath imports supported in Jest 27? |
Nope, waiting for |
We are using |
@zdm you can get around that by using |
The is the |
@googol that is correct. |
Do you know, how fast native jest support for imports can be implemented? |
I seem to be hitting this issue with ESLint 8.x (8.2.0 right now) and jest 27.3.1. I have local/custom ESLint rules, which I test with Jest and ESLint's
@mdjermanovic suggested the following
But this doesn't help me either. I also tried mapping
But still no fix. Am I at least on the right path here, thinking this is my issue and I need to wait for Jest to support these "subpath import" things (didn't know about such mappings until now)? Or is this some other issue and I should look elsewhere? |
Following. I have the exact same issue as @stefcameron with testing custom ESLint rules (jest 27.3.1 and eslint 8.2.0) |
@stefcameron What worked for us was mapping the
Our error had been
and, looking at Good luck and please let me know if this worked for you ! |
@cborchert Bingo! Thank you. 😄 I guess that's the one mapping combination I didn't try. |
Glad it worked out :) |
Wondering if this would work for sub-dependencies too (e.g. Chalk v5 is using subpath imports as well now and more packages will follow). Seems to be quite a hassle when more packages adapt it. |
More packages by different authors won’t likely follow tho; there’s a reason virtually nobody has upgraded from chalk v4 to chalk v5 (see the download counts per version on npm). |
Signed-off-by: Jaid <[email protected]>
Following-up after the release of Jest 28, I was able to drop the custom |
|
I seem to be in a weird state. With Jest 28 I get:
But if I remove the mapping, I'm back to the original error.
@stefcameron Was there any other changes you made by chance? |
I wish there was more than this, but this really is the only change I made as far as the Jest options go: Aside from that, I had to add a dependency to That was the extent of the changes that got me going after upgrading to Jest 28. I was on I do recall seeing a strange error related to this ESLint module after upgrading, and then I just tried removing the mapping since I had a feeling subpath support might get added to Jest 28, and it worked. I was on |
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
When running jest for a project that uses subpath imports, jest fails to resolve the imports.
To Reproduce
Steps to reproduce the behavior:
#logger
mapping to./logger/default.js
in my repro)Expected behavior
I would expect the import to be resolved just like when running the code itself, and the tests to run.
Link to repl or repo (highly encouraged)
https://github.com/googol/jest-subpath-import-repro
envinfo
The text was updated successfully, but these errors were encountered: