testBuildsByAnotherTcmAreMadeAgain
A build is of the app and of what tcm puts beside it in the browser, so one another tcm made (an older runtime) is made again, not reused: upgrading tcm reaches apps whose code didn't change
import { setUp } from "#codebase/tcmts/cli/test/e2e/prod"; import assert from "node:assert/strict"; import fs from "node:fs"; import path from "node:path"; export const testBuildsByAnotherTcmAreMadeAgain = () => { const { dir, tcm, scratch } = setUp(); scratch(`// tcm: namespace app export function main() { document.querySelector("#app")!.textContent = "hi"; } `); tcm("add"); assert.match(tcm("build", "app.main"), /built app\.main/); assert.doesNotMatch(tcm("build", "app.main"), /built/, "this tcm's build is reused"); const apps = path.join(dir, ".tcm", "apps"); const [build] = fs.readdirSync(apps).filter((f) => /^[a-z2-7]{52}$/.test(f)); const manifest = path.join(apps, build!, "tcm-app.json"); const made = JSON.parse(fs.readFileSync(manifest, "utf8")) as { tcm?: string }; assert.ok(made.tcm, "it says which tcm made it"); fs.writeFileSync(manifest, JSON.stringify({ ...made, tcm: "another,tcm" })); assert.match(tcm("build", "app.main"), /built app\.main/, "another tcm's is made again"); }