deno.land / x / ky@v0.31.3 / test / helpers / with-page.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import process from 'node:process';import type {ExecutionContext, UntitledMacro} from 'ava';import {chromium, Page} from 'playwright-chromium';
type Run = (t: ExecutionContext, page: Page) => Promise<void>;
const PWDEBUG = Boolean(process.env['PWDEBUG']);
export const withPage: UntitledMacro<any[]> = async (t: ExecutionContext, run: Run): Promise<void> => { const browser = await chromium.launch({ devtools: PWDEBUG, }); const page = await browser.newPage(); try { await run(t, page); } finally { await browser.close(); }};
ky

Version Info

Tagged at
a year ago