Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

playwright.config.ts

38 lines898 Bytes

1import { defineConfig, devices } from '@playwright/test'
2import { getTestServerPort } from '@tanstack/router-e2e-utils'
3import packageJson from './package.json' with { type: 'json' }
4​
5const PORT = await getTestServerPort(packageJson.name)
6const baseURL = `http://localhost:${PORT}`
7​
8/**
9 * See https://playwright.dev/docs/test-configuration.
10 */
11export default defineConfig({
12 testDir: './tests',
13 workers: 1,
14​
15 reporter: [['line']],
16​
17 globalSetup: './tests/setup/global.setup.ts',
18 globalTeardown: './tests/setup/global.teardown.ts',
19​
20 use: {
21 /* Base URL to use in actions like `await page.goto('/')`. */
22 baseURL,
23 },
24​
25 webServer: {
26 command: `pnpm build && pnpm preview --port ${PORT}`,
27 url: baseURL,
28 reuseExistingServer: !process.env.CI,
29 stdout: 'pipe',
30 },
31​
32 projects: [
33 {
34 name: 'chromium',
35 use: { ...devices['Desktop Chrome'] },
36 },
37 ],
38})