You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
native fs.existsSync('index.js/path'):
> false
mocked fs.existsSync('index.js/path'):
Error: ENOTDIR, not a directory 'index.js/path'
at FileSystem.getItem (/Users/viktor/code/sandbox/mock-fs-exists-sync-issue/node_modules/mock-fs/lib/filesystem.js:128:15)
at Binding.<anonymous> (/Users/viktor/code/sandbox/mock-fs-exists-sync-issue/node_modules/mock-fs/lib/binding.js:1488:31)
at maybeCallback (/Users/viktor/code/sandbox/mock-fs-exists-sync-issue/node_modules/mock-fs/lib/binding.js:85:17)
at Binding.exists (/Users/viktor/code/sandbox/mock-fs-exists-sync-issue/node_modules/mock-fs/lib/binding.js:1486:10)
at Binding.existsSync (/Users/viktor/code/sandbox/mock-fs-exists-sync-issue/node_modules/mock-fs/lib/binding.js:1507:15)
at Object.<anonymous> (/Users/viktor/code/sandbox/mock-fs-exists-sync-issue/node_modules/mock-fs/lib/index.js:39:39)
at Module.existsSync (node:fs:292:18)
at file:///Users/viktor/code/sandbox/mock-fs-exists-sync-issue/index.js:16:23
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24) {
code: 'ENOTDIR',
errno: -20,
path: 'index.js/path'
}
The text was updated successfully, but these errors were encountered:
I come across a library (oclif) that uses fs.existsSync in such way in its internals. This issue makes using the latest versions of mock-fs with code using that library impossible.
Workaround: use an older version of mock-fs (pre-#387, e.g. 5.2.0) and an older version of NodeJS (e.g. 18).
It looks like the
fs.existsSync
mock added in #387 is in some cases inconsistent with the actualfs.existsSync
behaviour.Example (
index.js
file):Expected output
Actual output
The text was updated successfully, but these errors were encountered: