mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 06:20:02 -04:00
log when oxc or scramjet internal error happens in test suite
This commit is contained in:
parent
98b5387a84
commit
e1a71bef1d
4 changed files with 25 additions and 2 deletions
|
@ -7,7 +7,7 @@ export default defineConfig({
|
||||||
testDir: "./tests",
|
testDir: "./tests",
|
||||||
fullyParallel: true,
|
fullyParallel: true,
|
||||||
forbidOnly: !!process.env.CI,
|
forbidOnly: !!process.env.CI,
|
||||||
retries: 0,
|
retries: 2,
|
||||||
reporter: "html",
|
reporter: "html",
|
||||||
timeout: 20000,
|
timeout: 20000,
|
||||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
|
|
|
@ -328,7 +328,7 @@ export class ScramjetClient {
|
||||||
if ((err.stack as any) instanceof Object) {
|
if ((err.stack as any) instanceof Object) {
|
||||||
//@ts-expect-error i'm not going to explain this
|
//@ts-expect-error i'm not going to explain this
|
||||||
err.stack = err.stack.stack;
|
err.stack = err.stack.stack;
|
||||||
console.error("ERROR FROM SCRMAJET INTERNALS", err);
|
console.error("ERROR FROM SCRAMJET INTERNALS", err);
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
17
tests/util/inspectConsole.ts
Normal file
17
tests/util/inspectConsole.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { Page } from "@playwright/test";
|
||||||
|
|
||||||
|
export function registerInspect(page: Page) {
|
||||||
|
let hasOxcError = false;
|
||||||
|
let hasScramjetError = false;
|
||||||
|
page.on("console", async (msg) => {
|
||||||
|
if (msg.type() === "error") {
|
||||||
|
if (msg.text().includes("oxc parse error") && !hasOxcError) {
|
||||||
|
hasOxcError = true;
|
||||||
|
console.log("OXC parse error detected! Please review manually.")
|
||||||
|
} else if (msg.text().includes("ERROR FROM SCRAMJET INTERNALS") && !hasScramjetError) {
|
||||||
|
hasScramjetError = true;
|
||||||
|
console.log("Scramjet error detected! Please review manually.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
/* eslint-disable no-async-promise-executor */
|
/* eslint-disable no-async-promise-executor */
|
||||||
import { expect, FrameLocator, Page } from "@playwright/test";
|
import { expect, FrameLocator, Page } from "@playwright/test";
|
||||||
|
import { registerInspect } from "./inspectConsole";
|
||||||
|
|
||||||
export function setupPage(page: Page, url: string): Promise<FrameLocator> {
|
export function setupPage(page: Page, url: string): Promise<FrameLocator> {
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
|
// Hack to disable HTTP cache.
|
||||||
|
await page.route("**", route => route.continue());
|
||||||
// Goto base url defined in config.
|
// Goto base url defined in config.
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
await page.waitForSelector(".version > b");
|
await page.waitForSelector(".version > b");
|
||||||
|
@ -18,6 +21,9 @@ export function setupPage(page: Page, url: string): Promise<FrameLocator> {
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
await bar.press("Enter");
|
await bar.press("Enter");
|
||||||
|
|
||||||
|
registerInspect(page);
|
||||||
|
|
||||||
resolve(frame);
|
resolve(frame);
|
||||||
});
|
});
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue