Error when running Jest: EISDIR: illegal operation on a directory
🐛 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
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
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?
@SimenB, yes, your idea works e.g. if (error.code !== 'ENOENT' && error.code !== 'EISDIR') {
great, wanna send a PR?
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.
#13157
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.