Files
hyperframes/packages/producer/scripts/test-classification.test.mjs
Miguel Ángel cff467a352 ci: select the remaining orphan tests in their owning runners (#4260)
* ci: select the remaining orphan tests in their owning runners

* ci: provide FFmpeg for the catalog preview witness

* ci: pass the installed Chrome path to catalog rendering

* test: align creator capability checks with speed ramp support

#4153 added supported speed ramps as rate lanes in data-automation. The
previously unselected capability tests still required preprocessing.
Require the documented rate-lane representation and its precedence over
the constant playback rate, matching the runtime resolver.
2026-09-22 00:54:41 -04:00

72 lines
2.3 KiB
JavaScript

import assert from "node:assert/strict";
import { describe, it } from "node:test";
import {
classifyTestSource,
discoverProducerTests,
summarizeTests,
} from "./test-classification.mjs";
describe("producer test classification", () => {
it("classifies each supported runner into one lane", () => {
assert.deepEqual(classifyTestSource("src/a.test.ts", 'import { it } from "bun:test";'), {
file: "src/a.test.ts",
runner: "bun",
lane: "unit",
});
assert.deepEqual(
classifyTestSource(
"src/a.test.ts",
'import { it } from "vitest";',
new Set(["src/a.test.ts"]),
),
{ file: "src/a.test.ts", runner: "vitest", lane: "integration" },
);
});
it("rejects missing and ambiguous runner imports", () => {
assert.throws(() => classifyTestSource("src/a.test.ts", "export {};"), /neither runner/);
assert.throws(
() =>
classifyTestSource(
"src/a.test.ts",
'import { it } from "bun:test"; import { expect } from "vitest";',
),
/both bun:test and vitest/,
);
});
it("classifies every current source test exactly once", () => {
const tests = discoverProducerTests();
assert.equal(new Set(tests.map((test) => test.file)).size, tests.length);
const summary = summarizeTests(tests);
assert.ok(summary.total > 0);
assert.equal(
summary.unit.bun + summary.unit.vitest + summary.integration.bun + summary.integration.vitest,
summary.total,
);
});
it("keeps the real-media natural-duration compiler test in the integration lane", () => {
const test = discoverProducerTests().find(
({ file }) => file === "src/services/htmlCompiler.naturalDuration.test.ts",
);
assert.deepEqual(test, {
file: "src/services/htmlCompiler.naturalDuration.test.ts",
runner: "bun",
lane: "integration",
});
});
});
it("selects the distributed smoke and playback parity tests as integration tests", () => {
const files = [
"tests/distributed/_smoke/webm-concat-copy.test.ts",
"tests/playback-rate-av-parity/playback-rate-av-parity.test.ts",
];
const selected = discoverProducerTests().filter((entry) => files.includes(entry.file));
assert.deepEqual(
selected,
files.map((file) => ({ file, runner: "bun", lane: "integration" })),
);
});