testLandingKeepsTheHistoryOfItsReleases
A branch that made a release lands with its history, squashed or not: the release is an entry of the branch's, so main's next release follows it, and a push of main carries it.
import { okIn, tempDir } from "#codebase/tcmts/cli/test/e2e/harness"; import assert from "node:assert/strict"; import fs from "node:fs"; import path from "node:path"; export const testLandingKeepsTheHistoryOfItsReleases = () => { const root = tempDir("released"); const dir = path.join(root, "a"); fs.mkdirSync(dir); const tcm = (...args: string[]) => okIn(dir, ...args); const scratch = (text: string) => fs.writeFileSync(path.join(dir, "scratch.ts"), text); tcm("init"); scratch( `// tcm: namespace lib\nexport const manifest = { name: "squares" };\nexport const square = (x: number): number => x * x;\n`, ); tcm("add"); tcm("branch", "feature"); tcm("switch", "feature"); scratch(`// tcm: namespace lib\nexport const cube = (x: number): number => x ** 3;\n`); tcm("add"); assert.match(tcm("release", "squares"), /released squares@0\.1\.0/); tcm("switch", "main"); scratch(`// tcm: namespace other\nexport const label = "powers";\n`); tcm("add"); const landed = tcm("merge", "feature", "--squash"); assert.match(landed, /merged feature into main as one entry, its history kept/); assert.match(landed, /feature made squares@0\.1\.0/); assert.doesNotMatch(tcm("status"), /branches with work main doesn't have/, "it landed"); // main's next release follows the branch's scratch(`// tcm: namespace lib\nexport const double = (x: number): number => x * 2;\n`); tcm("add"); assert.match(tcm("release", "check", "squares"), /\(after 0\.1\.0\)/); // and a push of main carries it const b = path.join(root, "b"); fs.mkdirSync(b); okIn(b, "init"); fs.rmSync(path.join(b, "scratch.ts")); tcm("remote", "add", "origin", b); tcm("push"); assert.match(okIn(b, "releases"), /squares {2}lib\n {2}0\.1\.0 /); }