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

playwright.config.ts

35 lines848 Bytes

1import { defineConfig, devices } from '@playwright/test'
2import { getTestServerPort } from '@tanstack/router-e2e-utils'
3import packageJson from './package.json' with { type: 'json' }
4​
5export const 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 use: {
18 /* Base URL to use in actions like `await page.goto('/')`. */
19 baseURL,
20 },
21​
22 webServer: {
23 command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,
24 url: baseURL,
25 reuseExistingServer: !process.env.CI,
26 stdout: 'pipe',
27 },
28​
29 projects: [
30 {
31 name: 'chromium',
32 use: { ...devices['Desktop Chrome'] },
33 },
34 ],
35})