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

playwright.config.ts

41 lines841 Bytes

1import { defineConfig, devices } from '@playwright/test'
2import { appServerReady } from '@tanstack/router-e2e-utils'
3​
4const mode = process.env.MODE ?? 'prod'
5const isDev = mode === 'dev'
6const PORT = Number(process.env.E2E_APP_PORT ?? 0)
7const baseURL = `http://localhost:${PORT}`
8​
9export default defineConfig({
10 testDir: './tests',
11 workers: 1,
12 reporter: [['line']],
13​
14 globalSetup: './tests/setup/global.setup.ts',
15​
16 use: {
17 baseURL,
18 },
19​
20 webServer: {
21 command: isDev
22 ? `pnpm dev:e2e --port 0`
23 : `pnpm build && PORT=${PORT} pnpm start`,
24 wait: appServerReady,
25 reuseExistingServer: false,
26 stdout: 'pipe',
27 env: {
28 VITE_NODE_ENV: 'test',
29 PORT: String(PORT),
30 },
31 },
32​
33 projects: [
34 {
35 name: 'chromium',
36 use: {
37 ...devices['Desktop Chrome'],
38 },
39 },
40 ],
41})