feat: update for Deno 2 (#2655)

Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
Marvin Hagemeister
2024-09-30 18:30:30 +02:00
committed by GitHub
co-authored by Luca Casonato
parent b5389f69a3
commit de8f1b0c59
32 changed files with 3836 additions and 3194 deletions
+13 -2
View File
@@ -91,7 +91,7 @@ export async function withBrowserApp(
}, await app.handler());
const browser = await launch({
args: ["--no-sandbox"],
args: ["--window-size=1280,720"],
headless: !Deno.args.includes("--headful"),
});
@@ -112,7 +112,7 @@ export async function withBrowser(fn: (page: Page) => void | Promise<void>) {
const aborter = new AbortController();
try {
const browser = await launch({
args: ["--no-sandbox"],
args: ["--window-size=1280,720"],
headless: !Deno.args.includes("--headful"),
});
@@ -120,6 +120,17 @@ export async function withBrowser(fn: (page: Page) => void | Promise<void>) {
// page.setDefaultTimeout(1000000);
try {
await fn(page);
} catch (err) {
try {
const raw = await page.content();
const doc = parseHtml(raw);
const html = prettyDom(doc);
// deno-lint-ignore no-console
console.log(html);
} catch {
// Ignore
}
throw err;
} finally {
await page.close();
await browser.close();