Closed paul23-git closed 4 years ago
That's not legit jest code. Following works on nodejs 14.4.0.
const mock = require("mock-fs");
const {existsSync} = require("fs");
describe("config-loader-loadJSON", function() {
beforeEach(function() {
const content = {
test: 123,
sub: {
a: '123'
}
};
mock({
'textFile.txt': 'This is file content',
'jsonFile.json': JSON.stringify(content),
});
});
afterEach(function() {
mock.restore();
});
it("Should load", async function() {
expect(existsSync("jsonFile.json")).toBeTruthy();
});
});
Well as per title, it seems no mocking occurs under nodejs 14.4.0. Using jest to test the following simple test "fails":