-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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]: Manual mocks file name for node protocol imports (node:) #14040
Comments
Perhaps I'm trying to think how the fix should look. Does this make sense? EDIT |
I found out when you use it without |
Any updates on this? |
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. |
Seems there is no update on this |
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. |
I think moving towards a separate folder is a good approach to match Node's migration to the URL scheme. This'll free up the module paths avoiding future collisions. But given the scale of imposing a change like this, maybe it should start as an opt in feature, i.e. |
@mrazauskas I can take a crack at this |
Go on (; I was playing with this a but. Here is one detail to think about: what happens if a user is importing from |
I agree, and for compatibility's sake, this should be the default behavior. I also think that we should add an option to force paths to use the node URL scheme and Eventually, this default behavior should be flipped where, to match Node's adoption, the expectation will be to always use the URL scheme and put manual mocks in the node folder. What do you think? |
It would be better to separate the fix of this issue and the The thing is that adding new options is always tricky. Jest has too many options. I see users who are already lost and can’t find what they look. Even simple helpers like the |
@mrazauskas Apologies for the late reply. I agree with your point and have just finished a fix to just the issue. |
Version
^29.5.0
Steps to reproduce
I have added minimal code setup to following codesandbox
https://codesandbox.io/p/sandbox/jest-issue-node-protocol-b6ivxb
Expected behavior
To work with
node:
protocol inputs in manaul mocks withoutnode:
in the file name.Actual behavior
I can get this working on MacOS renaming the file to node:os.ts
But does failed checkout in Windows as colon is not permited to use in filename. Also Codesandbox doesn't allows to have colons in the file.
Additional context
No response
Environment
System: OS: macOS 12.6.3 CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Binaries: Node: 18.14.2 - /usr/local/bin/node Yarn: 1.22.19 - ~/.yarn/bin/yarn npm: 9.5.0 - /usr/local/bin/npm
The text was updated successfully, but these errors were encountered: