-
Notifications
You must be signed in to change notification settings - Fork 87
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
createWriteStream is not mocked in node 16/17 #343
Comments
I deleted my previous reply, after I realised you said the file was created in real file system. It's bit odd, I checked our unit test code, it seems createWriteStream is creating mocked file just fine in node v16. |
Can you check node 14, whether your test code generates file in real file system too? |
What I guess is that your async You probably can try using the write stream's "close" or "finish" event callback to mark the ending of |
Hi 3cp! No, using node 14 no file is created in the real fs. Thx for the hint with the timing issue, i'll check that! |
Sorry for the late feedback. @3cp was right, error was on my side. It's working now! I appreciate the support and your work! |
Hi! I observed the following problem using mock-fs:
I've written a file using fs.createWriteStream:
https://github.com/BuZZ-T/rusted-chromium/blob/35bd03817439545ec52c66a4a75d93acb13eb477/download.ts#L87
and checked if it's written properly using mock-fs:
https://github.com/BuZZ-T/rusted-chromium/blob/35bd03817439545ec52c66a4a75d93acb13eb477/download.int.spec.ts#L113
This works on node 14. When running the tests with node 16 or 17, the tests fail:
https://app.travis-ci.com/github/BuZZ-T/rusted-chromium/builds/241287559
When i run the tests locally with node 16 and 17, i can see that the file is created in the real filesystem.
The functionality with the unmocked createWriteStream is working properly and the same for all tested node versions.
Am i doing sth. wrong, or is this a bug of mock-fs?
Thx for your help and your great work!
The text was updated successfully, but these errors were encountered: