Skip to content
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

Error when running Jest: EISDIR: illegal operation on a directory #11135

Closed
betfix opened this issue Mar 1, 2021 · 7 comments
Closed

Error when running Jest: EISDIR: illegal operation on a directory #11135

betfix opened this issue Mar 1, 2021 · 7 comments

Comments

@betfix
Copy link

betfix commented Mar 1, 2021

🐛 Bug Report

Jest throws an error:

Error: EISDIR: illegal operation on a directory, realpath 'Z:\Temp'
    at Function.realpathSync.native (fs.js:1588:3)
    at tryRealpath (D:\myproject\node_modules\jest-util\build\tryRealpath.js:26:39)
    at getCacheDirectory (D:myproject\node_modules\jest-config\build\getCacheDirectory.js:89:33)

The error disappears after going to node_modules\jest-config\build\Defaults.js and replacing line:
cacheDirectory: (0, _getCacheDirectory.default)(),
with:
cacheDirectory: 'Z:\\temp',

To Reproduce

  • Download ImDisk Toolkit for Windows (or perhaps other RAM disk tool), make a RAM disk (e.g. Z) and set Windows %TEMP% and %TMP% environment variables to a directory on this disk (e.g. Z:\temp)
  • Create a node project, install Jest and try to run a Jest test

Expected behavior

Jest should run a test.

Link to repl or repo (highly encouraged)

https://github.com/betfix/temp-jest-error

envinfo

  System:
    OS: Windows 10 10.0.18363
    CPU: (4) x64 Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
  Binaries:
    Node: 12.13.0 - D:\Program Files\nodejs\node.EXE
    Yarn: 1.17.3 - D:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.12.0 - D:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ^26.6.3 => 26.6.3
@git-commit
Copy link

I have the same issue on my system.
Project created with create-react-app and a Ramdisk with environment variables set by ImDisk as such:

TEMP=R:\Temp
TMP=R:\Temp

@SimenB
Copy link
Member

SimenB commented Mar 9, 2022

I don't have access to a windows machine, so can't really do anything here. But swallowing EISDIR in https://github.com/facebook/jest/blob/54420eb51baecaba7dff293770f8cb2579825731/packages/jest-util/src/tryRealpath.ts#L14-L16 seems reasonable? Can you test it?

@tophf
Copy link

tophf commented Aug 7, 2022

@SimenB, yes, your idea works e.g. if (error.code !== 'ENOENT' && error.code !== 'EISDIR') {

@SimenB
Copy link
Member

SimenB commented Aug 7, 2022

great, wanna send a PR?

@tophf
Copy link

tophf commented Aug 7, 2022

Probably not as I feel kinda intimidated by the amount of steps in PR guide as well as the need for CLA. Not soon'ish anyway.

KrishnaPG added a commit to KrishnaPG/jest that referenced this issue Aug 21, 2022
KrishnaPG added a commit to KrishnaPG/jest that referenced this issue Aug 21, 2022
@SimenB
Copy link
Member

SimenB commented Aug 22, 2022

#13157

@SimenB SimenB closed this as completed Aug 22, 2022
@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants