jest icon indicating copy to clipboard operation
jest copied to clipboard

jest fails to work when temp dir is on a RAM drive (Windows)

Open Mesqalito opened this issue 6 years ago • 7 comments

🐛 Bug Report

Jest fails on start with error Error: EISDIR: illegal operation on a directory, realpath 'B:\Temp' when windows temp dir is set on a RAM drive

Last working version

Worked in 23.6.0 Stopped working in 24.1.0

To Reproduce

  1. Follow the Getting Started guide and create a simple test suite
  2. Create RAM drive using ImDisk tool (B: in my case)
  3. Point windows temporary directory (%TEMP% env variable) to a directory on RAM drive (B:\Temp) (a reboot may be required)
  4. Open command line, go to where you created test suite and run npm run test

Actual behavior

I get an error like this:

Error: ENOENT: no such file or directory, realpath 'B:\Temp'
    at Function.realpathSync.native (fs.js:1514:3)
    at realpathSync (D:\Projects\***\node_modules\realpath-native\index.js:29:28)
    ...

Expected behavior

I expect jest to run tests.

Run npx envinfo --preset jest

  System:
    OS: Windows 10
    CPU: (4) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
  Binaries:
    Node: 10.14.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.9.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.3.0 - C:\Program Files\nodejs\npm.CMD

Mesqalito avatar Feb 25 '19 13:02 Mesqalito

same here

bluelovers avatar May 12 '19 09:05 bluelovers

in v24 it error, but in v23 it work

i think need to check this

Error: EISDIR: illegal operation on a directory, realpath 'T:\TEMP'
    at Function.realpathSync.native (fs.js:1513:3)
    at realpathSync (\node_modules
\realpath-native\index.js:29:28)
    at getCacheDirectory (\node_mo
dules\jest-config\build\getCacheDirectory.js:53:32)
    at Object.<anonymous> (\node_m
odules\jest-config\build\Defaults.js:40:50)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:1
0)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)

bluelovers avatar Jun 04 '19 06:06 bluelovers

Hi, I still have this problem. anyone plan to push 'bluelovers' pr?

avgalon avatar Mar 25 '20 09:03 avgalon

yes, i have the same problem, anyone can give a hand?

heavenkiller2018 avatar Apr 05 '20 00:04 heavenkiller2018

fs.realpathSync.native can't read ramdisk path. Here are the quick fix:

\node_modules\jest-util\build\tryRealpath.js

function tryRealpath(path) {
  try {
	if(path==='R:\\Temp'){ //your temp folder path
		return path;
	}
    path = _gracefulFs().realpathSync.native(path);
  } catch (error) {

but may be use "realpathSync" replace "realpathSync.native" can solve it too, but it may make some new problem...

Hocti avatar Apr 26 '21 13:04 Hocti

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.

github-actions[bot] avatar Apr 26 '22 13:04 github-actions[bot]

This can be fixed probably by reusing #6925 which solved the same problem in a different place.

tophf avatar Aug 07 '22 06:08 tophf