mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-04 04:46:59 +00:00
* fix(producer): a taken file-server port fails the render, and the late grading test runs in its lane * test(producer): run the taken-port file-server test under Node, where listen errors are events * test(producer): every *.integration.test.ts must sit in the integration lane * fix(producer): drop the explanatory comment on the file-server error handler
93 lines
3.1 KiB
JavaScript
93 lines
3.1 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { describe, it } from "node:test";
|
|
import {
|
|
classifyTestSource,
|
|
discoverProducerTests,
|
|
summarizeTests,
|
|
} from "./test-classification.mjs";
|
|
|
|
describe("producer test classification", () => {
|
|
it("keeps the integration list out of the selection logic the reachability check pins", () => {
|
|
const logic = readFileSync(new URL("./test-classification.mjs", import.meta.url), "utf8");
|
|
assert.doesNotMatch(logic, /["'][^"']*\/[^"']*\.test\.tsx?["']/);
|
|
const listed = JSON.parse(
|
|
readFileSync(new URL("./integration-tests.json", import.meta.url), "utf8"),
|
|
);
|
|
assert.equal(new Set(listed).size, listed.length);
|
|
});
|
|
|
|
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("runs every *.integration.test.ts in the integration lane, where sockets and real renders are allowed", () => {
|
|
const stray = discoverProducerTests().filter(
|
|
({ file, lane }) => file.endsWith(".integration.test.ts") && lane !== "integration",
|
|
);
|
|
assert.deepEqual(
|
|
stray.map(({ file }) => file),
|
|
[],
|
|
"add each to scripts/integration-tests.json",
|
|
);
|
|
});
|
|
|
|
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" })),
|
|
);
|
|
});
|