Open History to see the last commit
1import { defineConfig, devices } from '@playwright/test'
2import { appServerReady } from '@tanstack/router-e2e-utils'
3β
4const mode = process.env.MODE ?? 'ssr'
5β
6const distDir = process.env.E2E_DIST_DIR ?? 'dist'
7β
8const PORT = Number(process.env.E2E_APP_PORT ?? 0)
9const baseURL = `http://localhost:${PORT}`
10const commandByMode =
11 mode === 'preview'
12 ? `pnpm preview --host 0.0.0.0 --outDir ${distDir} --port ${PORT}`
13 : `pnpm start`
14β
15export default defineConfig({
16 testDir: './tests',
17 workers: 1,
18 reporter: [['line']],
19β
20 use: {
21 baseURL,
22 },
23β
24 webServer: {
25 command: commandByMode,
26 wait: appServerReady,
27 reuseExistingServer: false,
28 stdout: 'pipe',
29 env: {
30 NODE_OPTIONS: `${process.env.NODE_OPTIONS ?? ''} --import=@tanstack/router-e2e-utils/mock-api`,
31 MODE: mode,
32 START_PORT: '0',
33 PORT: String(PORT),
34 E2E_DIST_DIR: distDir,
35 },
36 },
37β
38 projects: [
39 {
40 name: 'chromium',
41 use: {
42 ...devices['Desktop Chrome'],
43 },
44 },
45 ],
46})