import { readFile } from "node:fs/promises"; import { describe, expect, it } from "vitest"; import { buildContractSet } from "../../scripts/generate-contract-set.ts"; import { DEV_RELEASE_MANIFEST, devReleaseManifest, } from "../../scripts/write-dev-release-manifest.ts"; /** * 1103 X2 #3. `create:feature` declares a contract package; the committed * dev manifest used to keep a fixed set, so the app it had just generated * refused to boot in `corepack pnpm dev` (CONTRACT_SET_PACKAGE_MISSING). */ describe("dev release manifest", () => { it("names the contract set of the installed features", async () => { const committed = JSON.parse(await readFile(DEV_RELEASE_MANIFEST, "utf8")) as Record< string, unknown >; expect( committed["contractSet"], `${DEV_RELEASE_MANIFEST} is stale; rewrite it with node scripts/write-dev-release-manifest.ts and commit it with the feature`, ).toEqual(JSON.parse(JSON.stringify(buildContractSet()))); }); it("changes only the contract set", async () => { const { contractSet, ...written } = JSON.parse(await devReleaseManifest()) as Record< string, unknown >; const { contractSet: _committedSet, ...committed } = JSON.parse( await readFile(DEV_RELEASE_MANIFEST, "utf8"), ) as Record; expect(written).toEqual(committed); expect(contractSet).toEqual(JSON.parse(JSON.stringify(buildContractSet()))); }); });