Skip to content

Commit 88c2f88

Browse files
committed
hide console errorrs during async write test
1 parent 31ea0db commit 88c2f88

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/logger/tests/logger.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,16 @@ it('should wait for async writers on flush', async () => {
315315
});
316316

317317
it('should handle async write errors on flush', async () => {
318+
const origConsoleError = console.error;
319+
console.error = vi.fn(() => {
320+
// noop
321+
});
322+
using _ = {
323+
[Symbol.dispose]() {
324+
console.error = origConsoleError;
325+
},
326+
};
327+
318328
let i = 0;
319329
const log = new Logger({
320330
writers: [
@@ -344,6 +354,7 @@ it('should handle async write errors on flush', async () => {
344354
[Error: Write failed! #2],
345355
]
346356
`);
357+
expect(console.error).toHaveBeenCalledTimes(2);
347358
}
348359
});
349360

0 commit comments

Comments
 (0)