Spaces:
Sleeping
Sleeping
Download backend/src/lib/inference/frontendProjection.test.ts from bardd/mike-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/bardd/mike-backend/resolve/main/backend/src/lib/inference/frontendProjection.test.ts
- Command line
-
hf download hf://spaces/bardd/mike-backend/backend/src/lib/inference/frontendProjection.test.ts
-
curl -L -o frontendProjection.test.ts https://huggingface.co/spaces/bardd/mike-backend/resolve/main/backend/src/lib/inference/frontendProjection.test.ts
1.3 kB
| 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); | |
| }); | |