Skip to content

Commit 9ec1622

Browse files
committed
test: exclude screenshot-gen from default E2E run; wire pdf-server tests
Bug 1: generate-grid-screenshots.spec.ts was running on every CI E2E invocation because playwright.config.ts had no testIgnore. This spec writes examples/*/grid-cell.png as a side effect — it's meant to be invoked only via npm run generate:screenshots. Added testIgnore gated on GENERATE_SCREENSHOTS env var (Playwright's testIgnore is stronger than explicit CLI file args, so a plain ignore would break generate:screenshots). Passed the env var through the docker invocation in generate:screenshots. Before: npx playwright test --list → 82 tests in 3 files After: npx playwright test --list → 65 tests in 2 files GENERATE_SCREENSHOTS=1 ... --list → 17 tests in 1 file (still works) Bug 2: examples/pdf-server/server.test.ts (448 LOC, 34 tests) was never run — root script was 'bun test src'. Changed to 'bun test src examples'. Only one .test. file exists in examples/ so no noise. Before: npm test → 87 pass across 3 files After: npm test → 121 pass across 4 files
1 parent 6b12fff commit 9ec1622

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"build": "npm run generate:schemas && npm run sync:snippets && node scripts/run-bun.mjs build.bun.ts && node scripts/link-self.mjs",
5151
"prepack": "npm run build",
5252
"build:all": "npm run examples:build",
53-
"test": "bun test src",
53+
"test": "bun test src examples",
5454
"test:e2e": "playwright test",
5555
"test:e2e:update": "playwright test --update-snapshots",
5656
"test:e2e:ui": "playwright test --ui",
@@ -64,7 +64,7 @@
6464
"prepare": "npm run build && husky",
6565
"docs": "typedoc",
6666
"docs:watch": "typedoc --watch",
67-
"generate:screenshots": "npm run build:all && docker run --rm -e EXAMPLE -v $(pwd):/work -w /work mcr.microsoft.com/playwright:v1.57.0-noble sh -c 'apt-get update -qq && apt-get install -qq -y python3-venv curl > /dev/null && curl -LsSf https://astral.sh/uv/install.sh | sh && export PATH=\"$HOME/.local/bin:$PATH\" && npm i -g bun && npm ci && npx playwright test tests/e2e/generate-grid-screenshots.spec.ts'",
67+
"generate:screenshots": "npm run build:all && docker run --rm -e EXAMPLE -e GENERATE_SCREENSHOTS=1 -v $(pwd):/work -w /work mcr.microsoft.com/playwright:v1.57.0-noble sh -c 'apt-get update -qq && apt-get install -qq -y python3-venv curl > /dev/null && curl -LsSf https://astral.sh/uv/install.sh | sh && export PATH=\"$HOME/.local/bin:$PATH\" && npm i -g bun && npm ci && npx playwright test tests/e2e/generate-grid-screenshots.spec.ts'",
6868
"prettier": "prettier -u \"**/*.{js,jsx,ts,tsx,mjs,json,md,yml,yaml}\" --check",
6969
"prettier:fix": "prettier -u \"**/*.{js,jsx,ts,tsx,mjs,json,md,yml,yaml}\" --write",
7070
"check:versions": "node scripts/check-versions.mjs",

playwright.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import { defineConfig, devices } from "@playwright/test";
22

33
export default defineConfig({
44
testDir: "./tests/e2e",
5+
// Exclude the screenshot generation spec from default runs.
6+
// It writes examples/*/grid-cell.png as a side effect and is meant to be
7+
// invoked only via `npm run generate:screenshots` (which sets
8+
// GENERATE_SCREENSHOTS=1 to bypass this ignore).
9+
testIgnore: process.env.GENERATE_SCREENSHOTS
10+
? []
11+
: ["**/generate-grid-screenshots.spec.ts"],
512
fullyParallel: true,
613
forbidOnly: !!process.env.CI,
714
retries: process.env.CI ? 2 : 0,

0 commit comments

Comments
 (0)