-
Notifications
You must be signed in to change notification settings - Fork 86
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
Test fails when using mock-fs #351
Comments
mock-fs replaces the entire file system, so there is virtually only one file on your computer: mock({
'file.ts': fileContents,
'node_modules/exit': mock.load('node_modules/exit'),
}); |
Because mockfs is designed to monkey patch fs subsystem, normally it can only survive small scale unit test. Mock fs, test something, then restore fs. It doesn't play well with other bigger tools which deals with file system constantly. For example jest. It will be very surprising if mockfs can work with playwright nicely. |
I have same issue. mock({
'node_modules/exit': mock.load('node_modules/exit'),
}); But, I use const mock = require('mock-fs')
afterEach(() => {
mock.restore()
})
it('should be successful.', async () => {
mock()
}) It's written on README. Please search by 'test' or 'restore'. This issue can be closed. |
In my tests I've just required
mock-fs
and then used:I get an error:
If I remove the
mock
function call, the tests run (without the mock of course).Any idea why this might happen?
The text was updated successfully, but these errors were encountered: