mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 23:00:03 +00:00
Follow-up on Miga's review of #2512. The regression fixture `escape-hatch-fatal-fallback` is tagged `field-signal-reproducer` and `known-broken` so it's skipped from the default sweep via `--exclude-tags transparency,field-signal-reproducer` in the `test:regression*` scripts in packages/producer/package.json. But `Dockerfile.test`'s ENTRYPOINT invoked the harness directly (`bunx tsx src/regression-harness.ts -- --sequential`), bypassing those scripts — so `bun run docker:test*` and the aws-lambda smoke tests would still try to run the known-broken fixture and fail. CI's own regression sweep was insulated only because it hardcodes per-shard positional test names that don't include this fixture, but that's incidental, not by design. Bake the exclude-tags into the Dockerfile.test ENTRYPOINT itself so every user of the image (local `docker:test*`, aws-lambda smoke, any adopter running the reference image) picks up the same skip contract. Docker CMD args appended after the entrypoint (e.g. matrix shard positional test names in .github/workflows/regression.yml, or `--mode=distributed-simulated`) still parse correctly — the harness applies excludeTags after testNames-filtering (see discoverTestSuites in regression-harness.ts). Also exports `parseArgs()` from regression-harness.ts and adds regression-harness-parse.test.ts to pin the `--exclude-tags` comma-parse contract, so any future change to the parser or the values baked into the Dockerfile / package.json will trip a red test rather than silently diverging. Verification A (harness comma-parses `--exclude-tags transparency, field-signal-reproducer`) already worked pre-fix; the new test file codifies it. Verification B (Docker ENTRYPOINT propagates the same skip) is what this commit fixes. Signed-off-by: Via
55 lines
2.3 KiB
TypeScript
55 lines
2.3 KiB
TypeScript
// 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([]);
|
|
});
|
|
});
|