testConflictsEditedInARow
Conflicts edited one after another each get a file of their own, named after the definition, rather than colliding on the default scratch file (or the one an update left behind).
import { withConflicts } from "#codebase/tcmts/cli/test/e2e/merge"; import assert from "node:assert/strict"; import fs from "node:fs"; import path from "node:path"; export const testConflictsEditedInARow = () => { const { dir, tcm } = withConflicts("merge in a row"); const leftover = fs.readFileSync(path.join(dir, "scratch.ts"), "utf8"); assert.match(tcm("edit", "lib.k"), /^wrote lib\.k to lib\.k\.ts$/m); const m = tcm("edit", "lib.m"); assert.match(m, /^wrote lib\.m to lib\.m\.ts$/m); assert.match(m, /It uses lib\.k, which is still conflicted/); assert.match(fs.readFileSync(path.join(dir, "lib.k.ts"), "utf8"), /const a = 10;/); assert.match(fs.readFileSync(path.join(dir, "lib.m.ts"), "utf8"), /k\(\) \+ 2/); assert.equal(fs.readFileSync(path.join(dir, "scratch.ts"), "utf8"), leftover); // a side kept whole is named so in history too tcm("resolve", "lib.m", "--ours"); assert.match(tcm("history"), /resolve lib\.m \(ours\)/); }