diff --git a/scripts/test-feature-scaffold.ts b/scripts/test-feature-scaffold.ts index 6a097718..3ed300d6 100644 --- a/scripts/test-feature-scaffold.ts +++ b/scripts/test-feature-scaffold.ts @@ -1,5 +1,7 @@ import { spawnSync } from "node:child_process"; +import { existsSync } from "node:fs"; import { mkdir, rm, writeFile } from "node:fs/promises"; +import path from "node:path"; import { loadCiGateContract } from "./contracts/ci-gates.ts"; import { @@ -67,6 +69,26 @@ try { ]); const checks: RemovalCheck[] = [created, createdWrite]; if (created.passed && createdWrite.passed) { + // The generator's Next: 3. A project re-records the initial JavaScript + // with its features (config/scale/feature-shape-ceilings.json, which + // test:unit compares with a build) and commits it with them. Without the + // sample there is no record to keep. + const measurement = "scripts/scale/measure-feature-shape-growth.ts"; + if (existsSync(path.join(fixtureRoot, measurement))) { + const recorded = spawnSync(process.execPath, [measurement, "--initial-baseline", "--write"], { + cwd: fixtureRoot, + stdio: "inherit", + }).status; + checks.push( + recorded === 0 + ? { name: "initial-javascript-record", passed: true } + : { + name: "initial-javascript-record", + passed: false, + failure: `node ${measurement} --initial-baseline --write exited ${recorded ?? "on a signal"}`, + }, + ); + } // Commits the copy with the feature, as a project would: git-based // checks (git grep, git ls-files) then see the feature's files. sealRemovalFixtureRepository(fixtureRoot);