Closed ddziara closed 9 months ago
Hello,
node ver: v20.9.0
the following code crashes (no such file) for readFileSync(). statSync() has the same problem.
import mock from 'mock-fs'; // import fs from "fs"; import fs from "fs/promises"; describe("Dummy test", () => { beforeEach(() => { mock({ '/index.md': '# Hello world!', }); }); afterEach(() => { mock.restore(); }); /* test("test1", () => { const buf = fs.readFileSync(`/index.md`); // no such file console.log(buf.toString()); }); test("test2", (done) => { fs.readFile(`/index.md`, (err, data) => { console.log(data.toString()); done(); }); }); */ test("test3", async () => { const buf = await fs.readFile(`/index.md`) console.log(buf.toString()); }); });
I'll close this as a duplicate of #380. If it looks like something else to you, feel free to reopen. I see that #381 includes some work toward a solution.
Hello,
node ver: v20.9.0
the following code crashes (no such file) for readFileSync(). statSync() has the same problem.