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 using mock-fs #374

Open
lyqht opened this issue Jul 4, 2023 · 3 comments
Open

Error when using mock-fs #374

lyqht opened this issue Jul 4, 2023 · 3 comments

Comments

@lyqht
Copy link

lyqht commented Jul 4, 2023

I'm getting an error when using Node version v18.14.2, and trying to test a code that uses fs.readFile,fs.readFileSync, fs.existsSync, fs.writeFileSync, fs.writeFile

The error

(node:72471) Warning: File descriptor 5 closed but not opened in unmanaged mode
(Use `node --trace-warnings ...` to show where the warning was created)
stdout | unknown test
[Error: EBADF: bad file descriptor, read] {
  errno: -9,
  code: 'EBADF',
  syscall: 'read'
}

I don't quite understand the error, how do I fix this?

@baob
Copy link

baob commented Aug 1, 2023

Was this an intermittent error, or consistent ?

I'm seeing intermittent errors like this on node 14.21.3 - x64 and mock-fs@4.14.0. Examples

    EAGAIN: resource temporarily unavailable, read
    EBADF: bad file descriptor, read

It might not be the same problem ... apologies if so.

@lyqht
Copy link
Author

lyqht commented Aug 1, 2023

It's a consistent error for me.

@baob
Copy link

baob commented Aug 2, 2023

Upgrading to latest mock-fs cured the flakiness for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants