chore: fail tests that contain unhandled errors (#724)

This commit is contained in:
Carlos Valente
2024-01-22 14:15:23 +01:00
committed by GitHub
parent fc5800bc21
commit c7328a33f6
+14
View File
@@ -0,0 +1,14 @@
import { expect, test as base } from '@playwright/test';
// fail tests which contain errors
export const test = base.extend({
page: async ({ page }, use) => {
const messages = [];
page.on('pageerror', (exception) => {
console.log(`Uncaught exception: "${exception.message}"`);
messages.push(exception);
});
await use(page);
expect(messages).toEqual([]);
},
});