Open NotWearingPants opened 4 months ago
Can you mention what version of Node you're using? As I suspect this might have been something that changed - note too we don't aim to 1:1 match the behaviour of Node especially in regards to error codes due to the potential number of differences across both Node majors and OSs, but this one seems like it should be straightforward to support.
I tested this with memfs v4.11.1 and Node.js v20.12.2
@G-Rath This is fixed in 4.12.0. This issue can be closed now.
@BadIdeaException do you know if we've got a test to ensure this doesn't regress in the future?
It looks like we might have actually have a test that verifies the opposite error than what we want here? But I'm on mobile so might have missed something 😅
Hmm, you're right. I didn't read closely enough. This is only fixed for creating a file, where openSync.test.ts tests that the correct error is thrown. (NB: mkdirSync.test.ts tests the analogous case when trying to create a directory under a file, at least in recursive mode.)
When trying to read from an illegally nested file, I am still seeing ENOENT, just like OP said.
Using
memfs
:Using the builtin
fs
(on Linux):Using the builtin
fs
(on Windows):I'm not sure which behavior makes more sense and if this difference is a bug in Node.js, but I think that if
!isWin
thenmemfs
should also throwENOTDIR
.