Skip to content

Commit d508b8f

Browse files
committed
omg Puppeteer tests
1 parent 1359571 commit d508b8f

File tree

5 files changed

+1125
-12
lines changed

5 files changed

+1125
-12
lines changed

globalSetup.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { GlobalSetupContext } from "vitest/node";
2+
import puppeteer, { Browser } from "puppeteer";
3+
4+
let browser: Browser;
5+
6+
export default async function setup({ provide }: GlobalSetupContext) {
7+
browser = await puppeteer.launch();
8+
provide("browserWSEndpoint", browser.wsEndpoint());
9+
}
10+
11+
export async function teardown() {
12+
await browser.close();
13+
}
14+
15+
declare module "vitest" {
16+
export interface ProvidedContext {
17+
browserWSEndpoint: string;
18+
}
19+
}

0 commit comments

Comments
 (0)