Closed NikhilVerma closed 2 years ago
Could you please explain a bit more about "swallow any console error methods logged outside the test environments" please? Do you have an example of such an issue?
@ValentinH absolutely! here is a rough example
// Any errors thrown here will never be shown to the user
throwConsoleError();
describe("my-test", () => {
it("fails on console", () => {
expect.assertions(1);
// This will work fine
throwConsoleError();
expect(1).toStrictEqual(1);
});
});
function throwConsoleError() {
console.error("I am a console error");
}
I just tested it and it works great! Thanks for the fix 🙏
Published as 2.0.5
🚀
This fixes the issue where this utility will swallow any console error methods logged outside the test environments. e.g. errors logged BEFORE setup/teardown of Jest tests.
I am also using the more native jest.spyOn to spy on the tests.