diff --git a/Dockerfile.test b/Dockerfile.test index faf73ba45..374d0a666 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -110,4 +110,14 @@ RUN cd packages/producer && bunx tsx scripts/generate-font-data.ts WORKDIR /app/packages/producer -ENTRYPOINT ["bunx", "tsx", "src/regression-harness.ts", "--", "--sequential"] +# Skip fixtures tagged `transparency` (Chrome alpha-channel PSNR quirks not +# reproducible on the CI image) and `field-signal-reproducer` (known-broken +# fixture per PR #2512 — codifies a real bug awaiting a fix). Mirrors the +# `--exclude-tags` in the local `test:regression*` scripts in +# packages/producer/package.json so `bun run docker:test*` and the aws-lambda +# smoke tests skip the same set. Docker CMD args from `docker run ...` +# are appended after these flags, so positional test names (e.g. shard args +# `hdr-regression style-5-prod ...` in .github/workflows/regression.yml) still +# resolve normally; the harness applies excludeTags whether testNames is empty +# or non-empty (see discoverTestSuites in src/regression-harness.ts). +ENTRYPOINT ["bunx", "tsx", "src/regression-harness.ts", "--", "--sequential", "--exclude-tags", "transparency,field-signal-reproducer"] diff --git a/packages/producer/src/regression-harness-parse.test.ts b/packages/producer/src/regression-harness-parse.test.ts new file mode 100644 index 000000000..ae7ba3933 --- /dev/null +++ b/packages/producer/src/regression-harness-parse.test.ts @@ -0,0 +1,54 @@ +// Pure-function tests for `parseArgs()` in the regression harness. Pins the +// `--exclude-tags` comma-parsing contract that the values baked into +// `Dockerfile.test` and `packages/producer/package.json` test scripts depend +// on. When someone changes the parser (e.g. to space-separated or repeated +// flags) these tests + the invocation strings in the Dockerfile / package.json +// must move together. + +import { describe, expect, it } from "bun:test"; +import { parseArgs } from "./regression-harness.js"; + +// parseArgs reads from index 2 onwards (node + script name are argv[0..1]). +const withProgram = (rest: string[]): string[] => ["node", "regression-harness.ts", ...rest]; + +describe("parseArgs() — --exclude-tags", () => { + it("splits a single --exclude-tags argument on commas", () => { + const opts = parseArgs(withProgram(["--exclude-tags", "transparency,field-signal-reproducer"])); + expect(opts.excludeTags).toEqual(["transparency", "field-signal-reproducer"]); + }); + + it("accepts a single tag with no comma", () => { + const opts = parseArgs(withProgram(["--exclude-tags", "transparency"])); + expect(opts.excludeTags).toEqual(["transparency"]); + }); + + it("supports repeated --exclude-tags flags (accumulating)", () => { + const opts = parseArgs( + withProgram(["--exclude-tags", "transparency", "--exclude-tags", "field-signal-reproducer"]), + ); + expect(opts.excludeTags).toEqual(["transparency", "field-signal-reproducer"]); + }); + + it("matches the values baked into Dockerfile.test ENTRYPOINT and package.json scripts", () => { + // Pins the exact string the Dockerfile.test ENTRYPOINT + package.json + // `test:regression*` scripts pass. If either invocation site changes to + // whitespace-separated or another delimiter, this test fails and forces + // an audit of the parser at the same time. + const opts = parseArgs( + withProgram([ + "--sequential", + "--exclude-tags", + "transparency,field-signal-reproducer", + "hdr-regression", + ]), + ); + expect(opts.sequential).toBe(true); + expect(opts.excludeTags).toEqual(["transparency", "field-signal-reproducer"]); + expect(opts.testNames).toEqual(["hdr-regression"]); + }); + + it("defaults excludeTags to an empty array when the flag is absent", () => { + const opts = parseArgs(withProgram([])); + expect(opts.excludeTags).toEqual([]); + }); +}); diff --git a/packages/producer/src/regression-harness.ts b/packages/producer/src/regression-harness.ts index d1c6dde2e..15e056819 100644 --- a/packages/producer/src/regression-harness.ts +++ b/packages/producer/src/regression-harness.ts @@ -241,7 +241,10 @@ function formatResidualSuffix(residualRmsDb: number | null, error: string | unde return `, residualRMS: ${residualRmsDb.toFixed(2)} dBFS`; } -function parseArgs(argv: string[]): CliOptions { +// Exported for unit testing (pinning `--exclude-tags` comma-parsing so the +// values baked into `Dockerfile.test` and `packages/producer/package.json` +// scripts keep matching the parser's contract). +export function parseArgs(argv: string[]): CliOptions { const testNames: string[] = []; const excludeTags: string[] = []; let update = false;