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

playwright.config.ts

42 lines941 Bytes

1import { defineConfig, devices } from '@playwright/test'
2import { appServerReady } from '@tanstack/router-e2e-utils'
3​
4const distDir = process.env.E2E_DIST_DIR ?? 'dist'
5​
6export const PORT = Number(process.env.E2E_APP_PORT ?? 0)
7const baseURL = `http://localhost:${PORT}`
8​
9/**
10 * See https://playwright.dev/docs/test-configuration.
11 */
12export default defineConfig({
13 testDir: './tests',
14 testIgnore: /rsbuild-cache\.spec\.ts/,
15 workers: 1,
16​
17 reporter: [['line']],
18​
19 use: {
20 /* Base URL to use in actions like `await page.goto('/')`. */
21 baseURL,
22 },
23​
24 webServer: {
25 command: `PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,
26 wait: appServerReady,
27 reuseExistingServer: false,
28 stdout: 'pipe',
29 env: {
30 PORT: String(PORT),
31 VITE_SERVER_PORT: String(PORT),
32 E2E_DIST_DIR: distDir,
33 },
34 },
35​
36 projects: [
37 {
38 name: 'chromium',
39 use: { ...devices['Desktop Chrome'] },
40 },
41 ],
42})