feat: update for Deno 2 (#2655)
Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
co-authored by
Luca Casonato
parent
b5389f69a3
commit
de8f1b0c59
+57
-50
@@ -33,62 +33,67 @@ function testApp<T>(): App<T> {
|
||||
return app;
|
||||
}
|
||||
|
||||
Deno.test("active links - without client nav", async () => {
|
||||
function View() {
|
||||
return (
|
||||
<Doc>
|
||||
<div>
|
||||
<h1>nav</h1>
|
||||
<p>
|
||||
<a href="/active_nav/foo/bar">/active_nav/foo/bar</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="/active_nav/foo">/active_nav/foo</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="/active_nav">/active_nav</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="/">/</a>
|
||||
</p>
|
||||
</div>
|
||||
</Doc>
|
||||
);
|
||||
}
|
||||
Deno.test({
|
||||
name: "active links - without client nav",
|
||||
fn: async () => {
|
||||
function View() {
|
||||
return (
|
||||
<Doc>
|
||||
<div>
|
||||
<h1>nav</h1>
|
||||
<p>
|
||||
<a href="/active_nav/foo/bar">/active_nav/foo/bar</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="/active_nav/foo">/active_nav/foo</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="/active_nav">/active_nav</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="/">/</a>
|
||||
</p>
|
||||
</div>
|
||||
</Doc>
|
||||
);
|
||||
}
|
||||
|
||||
const app = testApp()
|
||||
.get("/active_nav/foo", (ctx) => {
|
||||
return ctx.render(<View />);
|
||||
})
|
||||
.get("/active_nav", (ctx) => {
|
||||
return ctx.render(<View />);
|
||||
});
|
||||
const app = testApp()
|
||||
.get("/active_nav/foo", (ctx) => {
|
||||
return ctx.render(<View />);
|
||||
})
|
||||
.get("/active_nav", (ctx) => {
|
||||
return ctx.render(<View />);
|
||||
});
|
||||
|
||||
const server = new FakeServer(await app.handler());
|
||||
let res = await server.get("/active_nav");
|
||||
let doc = parseHtml(await res.text());
|
||||
const server = new FakeServer(await app.handler());
|
||||
let res = await server.get("/active_nav");
|
||||
let doc = parseHtml(await res.text());
|
||||
|
||||
assertSelector(doc, "a[href='/'][data-ancestor]");
|
||||
assertSelector(doc, "a[href='/'][data-ancestor]");
|
||||
|
||||
// Current
|
||||
assertNotSelector(doc, "a[href='/active_nav'][data-ancestor]");
|
||||
assertSelector(doc, "a[href='/active_nav'][data-current]");
|
||||
assertSelector(doc, `a[href='/active_nav'][aria-current="page"]`);
|
||||
// Current
|
||||
assertNotSelector(doc, "a[href='/active_nav'][data-ancestor]");
|
||||
assertSelector(doc, "a[href='/active_nav'][data-current]");
|
||||
assertSelector(doc, `a[href='/active_nav'][aria-current="page"]`);
|
||||
|
||||
// Unrelated links
|
||||
assertNotSelector(doc, "a[href='/active_nav/foo'][data-ancestor]");
|
||||
assertNotSelector(doc, "a[href='/active_nav/foo'][aria-current]");
|
||||
assertNotSelector(doc, "a[href='/active_nav/foo/bar'][data-ancestor]");
|
||||
assertNotSelector(doc, "a[href='/active_nav/foo/bar'][aria-current]");
|
||||
// Unrelated links
|
||||
assertNotSelector(doc, "a[href='/active_nav/foo'][data-ancestor]");
|
||||
assertNotSelector(doc, "a[href='/active_nav/foo'][aria-current]");
|
||||
assertNotSelector(doc, "a[href='/active_nav/foo/bar'][data-ancestor]");
|
||||
assertNotSelector(doc, "a[href='/active_nav/foo/bar'][aria-current]");
|
||||
|
||||
res = await server.get(`/active_nav/foo`);
|
||||
doc = parseHtml(await res.text());
|
||||
assertSelector(doc, "a[href='/active_nav/foo'][data-current]");
|
||||
assertSelector(doc, `a[href='/active_nav/foo'][aria-current="page"]`);
|
||||
assertSelector(doc, "a[href='/active_nav'][data-ancestor]");
|
||||
assertSelector(doc, `a[href='/active_nav'][aria-current="true"]`);
|
||||
assertSelector(doc, "a[href='/'][data-ancestor]");
|
||||
assertSelector(doc, `a[href='/'][aria-current="true"]`);
|
||||
res = await server.get(`/active_nav/foo`);
|
||||
doc = parseHtml(await res.text());
|
||||
assertSelector(doc, "a[href='/active_nav/foo'][data-current]");
|
||||
assertSelector(doc, `a[href='/active_nav/foo'][aria-current="page"]`);
|
||||
assertSelector(doc, "a[href='/active_nav'][data-ancestor]");
|
||||
assertSelector(doc, `a[href='/active_nav'][aria-current="true"]`);
|
||||
assertSelector(doc, "a[href='/'][data-ancestor]");
|
||||
assertSelector(doc, `a[href='/'][aria-current="true"]`);
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -171,4 +176,6 @@ Deno.test({
|
||||
assertSelector(doc, `a[href='/'][aria-current="true"]`);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ export function NodeProcess() {
|
||||
}, []);
|
||||
|
||||
// @ts-ignore bundling
|
||||
// deno-lint-ignore no-node-globals
|
||||
// deno-lint-ignore no-process-globals
|
||||
const value = IS_BROWSER ? process.env.NODE_ENV : "no";
|
||||
|
||||
return (
|
||||
|
||||
@@ -64,6 +64,8 @@ Deno.test({
|
||||
await waitForText(page, ".output", "4");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -94,6 +96,8 @@ Deno.test({
|
||||
await waitForText(page, "#multiple-2 .output", "1");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -123,6 +127,8 @@ Deno.test({
|
||||
await waitForText(page, "#counter-2 .output", "1");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -151,6 +157,8 @@ Deno.test({
|
||||
expect(json).toEqual({ foo: 123 });
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -174,6 +182,8 @@ Deno.test({
|
||||
await page.locator(".ready").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -204,6 +214,8 @@ Deno.test({
|
||||
expect(html).not.toContain("import { Counter }");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -232,6 +244,8 @@ Deno.test({
|
||||
expect(doc.querySelector(".children")!.childNodes.length).toEqual(0);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -262,6 +276,8 @@ Deno.test({
|
||||
expect(JSON.parse(text)).toEqual({ jsx: true, children: true });
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -297,6 +313,8 @@ Deno.test({
|
||||
expect(childText).toEqual("foobar");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -329,6 +347,8 @@ Deno.test({
|
||||
await waitForText(page, ".output", "1");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -372,6 +392,8 @@ Deno.test({
|
||||
await waitForText(page, ".children .output", "1");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -415,6 +437,8 @@ Deno.test({
|
||||
await waitForText(page, ".children .output", "1");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -489,6 +513,8 @@ Deno.test({
|
||||
expect(radio2).toEqual(true);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -519,6 +545,8 @@ Deno.test({
|
||||
expect(text).toEqual("it works");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -548,6 +576,8 @@ Deno.test({
|
||||
expect(text).toEqual("it works");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -576,6 +606,8 @@ Deno.test({
|
||||
expect(text).toEqual("value: production");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -601,6 +633,8 @@ Deno.test({
|
||||
await waitForText(page, ".output", "1");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -631,6 +665,8 @@ Deno.test({
|
||||
expect(falsy).toEqual("false");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -659,6 +695,8 @@ Deno.test({
|
||||
expect(text).toEqual("it works");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -685,4 +723,6 @@ Deno.test({
|
||||
/<\/fresh-runtime\.js\?__frsh_c=[^>]+>; rel="modulepreload"; as="script", <\/SelfCounter\.js\?__frsh_c=[^>]+>; rel="modulepreload"; as="script"/,
|
||||
);
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
@@ -74,6 +74,8 @@ Deno.test({
|
||||
await waitForText(page, ".output", "partial update");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -115,6 +117,8 @@ Deno.test({
|
||||
assertNotSelector(doc, ".init");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -155,6 +159,8 @@ Deno.test({
|
||||
);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -193,6 +199,8 @@ Deno.test({
|
||||
|
||||
// TODO: Check error overlay
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
// See https://github.com/denoland/fresh/issues/2254
|
||||
@@ -236,6 +244,8 @@ Deno.test({
|
||||
expect(didError).toEqual(false);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -274,6 +284,8 @@ Deno.test({
|
||||
await page.locator(".ready").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -307,6 +319,8 @@ Deno.test({
|
||||
|
||||
// TODO: Test error overlay
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -347,6 +361,8 @@ Deno.test({
|
||||
});
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -391,6 +407,8 @@ Deno.test({
|
||||
expect(counter).toEqual("1");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -437,6 +455,8 @@ Deno.test({
|
||||
assertNotSelector(doc, ".output");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -476,6 +496,8 @@ Deno.test({
|
||||
await page.locator(".inner-update").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -527,6 +549,8 @@ Deno.test({
|
||||
await page.locator(".sib-3-update").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -586,6 +610,8 @@ Deno.test({
|
||||
await waitForText(page, "#c .output", "3");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -658,6 +684,8 @@ Deno.test({
|
||||
await waitForText(page, "#c .output", "3");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -730,6 +758,8 @@ Deno.test({
|
||||
await waitForText(page, "#c .output", "3");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -795,6 +825,8 @@ Deno.test({
|
||||
await waitForText(page, "#c .output", "3");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -862,6 +894,8 @@ Deno.test({
|
||||
assertNotSelector(doc, ".done-0");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -910,6 +944,8 @@ Deno.test({
|
||||
assertNotSelector(doc, ".done-0");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -956,6 +992,8 @@ Deno.test({
|
||||
expect(doc.querySelector(".content")!.textContent).toEqual("init01");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1005,6 +1043,8 @@ Deno.test({
|
||||
expect(doc.querySelector(".content")!.textContent).toEqual("init01");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1050,6 +1090,8 @@ Deno.test({
|
||||
expect(doc.querySelector(".content")!.textContent).toEqual("10init");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1099,6 +1141,8 @@ Deno.test({
|
||||
expect(doc.querySelector(".content")!.textContent).toEqual("10init");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1155,6 +1199,8 @@ Deno.test({
|
||||
});
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1210,6 +1256,8 @@ Deno.test({
|
||||
});
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1275,6 +1323,8 @@ Deno.test({
|
||||
});
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1340,6 +1390,8 @@ Deno.test({
|
||||
});
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1396,6 +1448,8 @@ Deno.test({
|
||||
expect(scroll.scrollY > 100).toEqual(true);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1443,6 +1497,8 @@ Deno.test({
|
||||
await page.locator(".done-foo-sub").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1493,6 +1549,8 @@ Deno.test({
|
||||
expect(pathname).toEqual("/foo");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1541,6 +1599,8 @@ Deno.test({
|
||||
await page.locator(".done-foo-sub").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1595,6 +1655,8 @@ Deno.test({
|
||||
expect(pathname).toEqual("/done");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1654,6 +1716,8 @@ Deno.test({
|
||||
await page.locator(".done-foo-sub").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1714,6 +1778,8 @@ Deno.test({
|
||||
await page.locator(".done-foo-sub").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1782,6 +1848,8 @@ Deno.test({
|
||||
assertNotSelector(doc, "button");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1840,6 +1908,8 @@ Deno.test({
|
||||
await page.locator(".done-a-b-c").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1868,6 +1938,8 @@ Deno.test({
|
||||
expect(logs).toEqual([]);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1903,6 +1975,8 @@ Deno.test({
|
||||
expect(scroll > 0).toEqual(true);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -1948,6 +2022,8 @@ Deno.test({
|
||||
expect(logs[0]).toMatch(/Found no partials/);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -2044,6 +2120,8 @@ Deno.test({
|
||||
expect(textColor).toEqual("rgb(0, 128, 0)");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -2131,6 +2209,8 @@ Deno.test({
|
||||
).toEqual(true);
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -2171,6 +2251,8 @@ Deno.test({
|
||||
await page.locator(".status-refreshed").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -2222,6 +2304,8 @@ Deno.test({
|
||||
await waitForText(page, "#inner .output", "1");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -2258,6 +2342,8 @@ Deno.test({
|
||||
await page.locator(".done").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -2293,6 +2379,8 @@ Deno.test({
|
||||
await page.locator(".error-404").wait();
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -2331,6 +2419,8 @@ Deno.test({
|
||||
expect(title).toEqual("after update");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
@@ -2374,4 +2464,6 @@ Deno.test({
|
||||
expect(`${url.pathname}${url.search}`).toEqual("/");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
+13
-2
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user