-
-
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
require.resolve
with options seems have different result in some case
#9502
Comments
require.resolve
with options seems had different result in some caserequire.resolve
with options seems have different result in some case
Yes, perhaps this evening, not sure |
Sooo this actually used to be Node's behavior back when I implemented it. Try it with Node <= 11 and see that it also resolves |
How about try |
Yeah I guess feature detection would be nicer than plain version checks. |
Seeing how many issues were opened due to the changed behavior in v12, I think feature detection is the correct way. That way people avoid false negatives (and positives) across node versions. Jest's I'm fine with fixing it for node 12 and 13 though, even though that might break people |
I'll put it on my list, but if anyone else wants to pick this up, just leave a message here and have a go! |
Since we've merged the migration to |
Not sure, I haven't looked into it, would that integrate with mocks etc., so all the things that |
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 14 days. |
This issue was closed because it has been stalled for 7 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
require.resolve
with options seems had different result in some caseresult differently with
require.resolve
from Node.jsTo Reproduce
Steps to reproduce the behavior:
A reproduction repo /~https://github.com/fisker/jest-require-resolve-bug , see
readme.md
in that repo.Expected behavior
Should try resolve
foo
package innode_modules
, instead of returningfoo/node_modules/bar/index.js
fileLink to repl or repo (highly encouraged)
reproduction repo
/~https://github.com/fisker/jest-require-resolve-bug
issue found on this PR on
prettier
prettier/prettier#7508
envinfo
The text was updated successfully, but these errors were encountered: