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

playwright.config.ts

36 lines917 Bytes

1import { defineConfig, devices } from '@playwright/test'
2import {
3 getDummyServerPort,
4 getTestServerPort,
5} from '@tanstack/router-e2e-utils'
6import packageJson from './package.json' with { type: 'json' }
7​
8const PORT = await getTestServerPort(packageJson.name)
9const EXTERNAL_PORT = await getDummyServerPort(packageJson.name)
10​
11const baseURL = `http://localhost:${PORT}`
12​
13export default defineConfig({
14 testDir: './tests',
15 workers: 1,
16​
17 reporter: [['line']],
18​
19 use: {
20 baseURL,
21 },
22​
23 webServer: {
24 command: `VITE_NODE_ENV="test" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV="test" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,
25 url: baseURL,
26 reuseExistingServer: !process.env.CI,
27 stdout: 'pipe',
28 },
29​
30 projects: [
31 {
32 name: 'chromium',
33 use: { ...devices['Desktop Chrome'] },
34 },
35 ],
36})