Closed cloakedninjas closed 4 years ago
Because your test code is wrong, your doSomething
happened before beforeEach
executes.
Try
describe('test', () => {
beforeEach(() => {
mockFS({
'assets': {}
});
});
afterEach(() => {
mockFS.restore();
});
it(test', () => {
test.doSomething();
});
});
Given a simple example
And the following test:
Produces the error:
ENOENT: no such file or directory, mkdir 'assets/new-dir'
- which sounds like FS is actually trying to make that directory, in fact it is, because if I use{recursive: true}
I get an actual folder created on my machineFYI - I'm using Node v12.16.1