Files
fusion/scripts/__tests__/release-package-contract.test.mjs
2026-08-03 12:16:32 -07:00

29 lines
1.1 KiB
JavaScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
import { URL } from "node:url";
const source = readFileSync(new URL("../release.mjs", import.meta.url), "utf8");
test("local releases build the complete published package surface", () => {
assert.match(
source,
/info\("Building all packages…"\);\s*run\("pnpm build:full"\);/,
"release.mjs must enable the full CLI package build before packing",
);
});
test("release smoke typechecks a consumer of the packed plugin SDK", () => {
const smokeStart = source.indexOf("function runReleaseSmoke()");
const smokeEnd = source.indexOf("function cleanupSmoke", smokeStart);
const smoke = source.slice(smokeStart, smokeEnd);
assert.notEqual(smokeStart, -1);
assert.notEqual(smokeEnd, -1);
assert.match(smoke, /plugin-sdk-consumer\.ts/);
assert.match(smoke, /@runfusion\/fusion\/plugin-sdk/);
assert.match(smoke, /spawnSync\(\s*"pnpm",\s*\["exec", "tsc", "--project", consumerTsconfigPath\]/);
assert.match(smoke, /timeout: 120_000/);
assert.match(smoke, /if \(typecheck\.status !== 0\)/);
});