-
-
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
rootDir incorrectly set in Windows if using SUBST drive #8063
Comments
Are you able to send a PR for it? None of the core team uses Windows, so we'll need help from the community on this one We do call The info at the bottom doesn't include which Jest version you are using, could you add that? |
Ah sorry, description updated with Jest version. I'll have a look and see if I can see something. |
Stepping through the code, the line that is causing it is this one: process.cwd() returns the correct path (e.g. I'm stepping through transpiled code, so realpath gets converted to |
Ok, thanks! And following the link is wrong? That's odd. Seems like we should be We went through and called |
I've followed it to this point: It steps into that I've looked at https://nodejs.org/api/fs.html#fs_fs_realpath_path_options_callback and that gives me the impression it will resolve 'symbolic links', so I replaced line 36 with I can't say this is the correct solution though as I'm not knowledgeable on UPDATE: this only worked because an exception was being thrown and it went down to the final return, which worked for me |
This is a fix for the bug reported here: jestjs/jest#8063 I'm not sure if this is the correct fix or not, it would be good to get verification before merge. Though Jest on my local machine is now operating correctly after this change.
I made a PR for a suggested code change (which I've since realised was garbage!).... Currently I am removing the following lines locally. Jest functions correctly once I've done that: I've not created the PR for this as I don't think it's the right solution |
@mjlawrence83 I have exactly the same issue. Did you get anywhere with this beyond the workaround you mentioned? |
Also having this issue. rootDir is returning C:/ drive location rather than I:/ drive which is the configured location of the project files in intellij. Was there a real fix for this? |
Workaround: if you run |
Yea that's what I did and it works... Just not a fan of changing my env variables to fit needs of one package. Hoping I haven't broken other things that were working. Fingers crossed. Is this fixed in a later version of jest? I am on jest version 25.1.0 |
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 30 days. |
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 30 days. |
This issue was closed because it has been stalled for 30 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
I'm having problems using Jest in unison with VSCode (1.28.2) on a Windows 7 VDI machine provided by my employers.
We are asked to clone git repos onto our
I:
drives (as these are much faster). TheseI:
drives actually appear to be created via the SUBST command from this folderC:\Users\<username>\Scratch
, though this is supposed to be abstracted from everyone.When I open a repo in VSCode, I do so from the
I:
drive location. When I then try to add breakpoints & debug, none of the breakpoints become verified.In addition to this, when running the tests in the terminal from the
I:
drive location, the file paths in the coverage report are pointing to theC:\Users\<username>\Scratch
location.After a bit of a play I can see immediately that rootDir is being set to the
C:\Users\<username>\Scratch
location. I've tried to override this by setting it to theI:
location in jest.config.js, but it doesn't seem to like me setting anything to a drive other thanC:
If I then close VSCode and re-open the repo from the
C:
location, debugging works.To Reproduce
C:
drive using SUBST (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/subst)Expected behavior
Link to repl or repo (highly encouraged)
Please provide either a repl.it demo or a minimal repository on GitHub.
Issues without a reproduction link are likely to stall.
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: