Spaces:
Sleeping
Sleeping
File size: 1,303 Bytes
06671aa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { spawnSync } from "node:child_process";
import test from "node:test";
const repoRoot = path.join(__dirname, "../../../..");
const generatedPath = path.join(
repoRoot,
"frontend/src/generated/inference-config.json",
);
const exportScript = path.join(
repoRoot,
"backend/scripts/export-inference-frontend-config.mjs",
);
function runExport(): void {
const result = spawnSync("node", [exportScript], {
cwd: path.join(repoRoot, "backend"),
encoding: "utf8",
});
assert.equal(
result.status,
0,
`frontend inference export failed: ${result.stderr || result.stdout}`,
);
}
test("frontend inference config matches the canonical manifest", () => {
const committed = fs.readFileSync(generatedPath, "utf8");
runExport();
assert.equal(
fs.readFileSync(generatedPath, "utf8"),
committed,
"run npm run export:inference-config and commit the generated artifact",
);
});
test("frontend inference config export is deterministic", () => {
runExport();
const first = fs.readFileSync(generatedPath, "utf8");
runExport();
assert.equal(fs.readFileSync(generatedPath, "utf8"), first);
});
|