WIP: Vitest: make tests fail if they show a warning or error on console #1465

Closed
jon wants to merge 3 commits from Fix-MakeTestsFail into dev
1 changed files with 11 additions and 0 deletions

View File

@ -1 +1,12 @@
// This file will be run before each test file, don't delete or vitest will not work.
import { vi, beforeEach, afterEach } from 'vitest';
beforeEach(() => {
vi.spyOn(console, 'warn').mockImplementation((message) => {
throw new Error(`Test failed due to console.warn: ${message}`);
});
});
afterEach(() => {
vi.restoreAllMocks();
});