Skip to content

Commit 72c973e

Browse files
committed
work
1 parent fe24c7b commit 72c973e

2 files changed

Lines changed: 8 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ jobs:
4848
- name: Type check project
4949
run: deno task check:types
5050

51+
- name: Disable AppArmor
52+
if: ${{ matrix.os == 'ubuntu-latest' }}
53+
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
54+
5155
- name: Run tests
5256
run: deno task test
5357

tests/test_utils.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@ import { FreshAttrs } from "./fixtures_islands/FreshAttrs.tsx";
2929
import { OptOutPartialLink } from "./fixtures_islands/OptOutPartialLink.tsx";
3030

3131
const browser = await launch({
32-
args: [
33-
"--window-size=1280,7201",
34-
...((Deno.env.get("CI") && Deno.build.os === "linux")
35-
? ["--no-sandbox"]
36-
: []),
37-
],
32+
args: ["--window-size=1280,720"],
3833
headless: true,
3934
});
4035

@@ -93,24 +88,22 @@ export async function withBrowserApp(
9388
fn: (page: Page, address: string) => void | Promise<void>,
9489
) {
9590
const aborter = new AbortController();
96-
const server = Deno.serve({
91+
await using server = Deno.serve({
9792
hostname: "localhost",
9893
port: 0,
9994
signal: aborter.signal,
10095
}, await app.handler());
10196

102-
const page = await browser.newPage();
10397
try {
98+
await using page = await browser.newPage();
10499
await fn(page, `http://localhost:${server.addr.port}`);
105100
} finally {
106-
await page.close();
107101
aborter.abort();
108-
await server?.finished;
109102
}
110103
}
111104

112105
export async function withBrowser(fn: (page: Page) => void | Promise<void>) {
113-
const page = await browser.newPage();
106+
await using page = await browser.newPage();
114107
try {
115108
await fn(page);
116109
} catch (err) {
@@ -120,8 +113,6 @@ export async function withBrowser(fn: (page: Page) => void | Promise<void>) {
120113
// deno-lint-ignore no-console
121114
console.log(html);
122115
throw err;
123-
} finally {
124-
await page.close();
125116
}
126117
}
127118

0 commit comments

Comments
 (0)