Run tests in a headless browser with vitest browser mode and playwright

This commit is contained in:
Alejandro Celaya
2025-04-08 11:49:33 +02:00
parent 09559c78af
commit 691e6c1afb
15 changed files with 451 additions and 182 deletions

View File

@@ -24,17 +24,13 @@ describe('ServersExporter', () => {
const createCsvjsonMock = (throwError = false) => (throwError ? erroneousToCsv : vi.fn(() => ''));
describe('exportServers', () => {
let originalConsole: Console;
const error = vi.fn();
beforeEach(() => {
originalConsole = global.console;
global.console = fromPartial<Console>({ error });
(global as any).Blob = class Blob {};
(global as any).URL = { createObjectURL: () => '' };
vi.stubGlobal('console', fromPartial<Console>({ error }));
});
afterEach(() => {
global.console = originalConsole;
vi.unstubAllGlobals();
});
it('logs an error if something fails', () => {