Files
stockfill/playwright.config.ts
T
beatzaplenty 6192bd20eb modified: .gitignore
modified:   .vscode/launch.json
	new file:   e2e/playwright-collect-coverage.spec.ts
	modified:   package-lock.json
	modified:   package.json
	modified:   playwright.config.ts
	new file:   scripts/merge-lcov.cjs
	new file:   scripts/normalize-lcov.cjs
	new file:   scripts/playwright-collect-coverage.cjs
	new file:   scripts/remap-and-report.cjs
	modified:   vite.config.ts
	new file:   vitest.config.ts
2025-12-02 16:14:12 +10:00

42 lines
1.4 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
import { defineCoverageReporterConfig } from '@bgotink/playwright-coverage';
import path from 'path';
export default defineConfig({
reporter: [
['list'],
[
'@bgotink/playwright-coverage',
defineCoverageReporterConfig({
sourceRoot: process.cwd(), // root used to resolve source files
exclude: ['node_modules/**', 'e2e/**'], // exclude test sources and deps
resultDir: path.join(process.cwd(), 'coverage-reports/e2e'),
reports: [
['html'], // interactive HTML at results/e2e-coverage/index.html
['lcovonly', { file: 'coverage.lcov' }], // LCOV for CI
['text-summary', { file: null }], // summary in console
],
// If your source maps produce wrong paths, add rewritePath:
// rewritePath: ({ absolutePath, relativePath }) => absolutePath
}),
],
],
testDir: './e2e',
fullyParallel: false,
workers: 4,
retries: process.env.CI ? 2 : 0,
use: {
baseURL: 'http://127.0.0.1:4173',
headless: true,
trace: 'on-first-retry',
navigationTimeout: 60_000, // 60s for page.goto / navigations
actionTimeout: 30_000, // optional: for clicks/typing etc (default 30s)
},
webServer: {
command: 'E2E_COVERAGE=1 npm run dev -- --host --port 4173',
url: 'http://127.0.0.1:4173',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
},
});