testAMergeNotFinishedIsntPushed

tcmts.cli.test.e2e.merge.testAMergeNotFinishedIsntPushed · #juwezbxs · term

A merge not finished stays where it was made: pushing the branch sends the branch as it is (not the merge), and a codebase pulling it has nothing to settle; the merge waits on here.

import { okIn, tempDir, withChildren } from "#codebase/tcmts/cli/test/e2e/harness";
import { withConflicts } from "#codebase/tcmts/cli/test/e2e/merge";
import { startServer } from "#codebase/tcmts/cli/test/e2e/sync";
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";

export const testAMergeNotFinishedIsntPushed = () =>
  withChildren(async (keep) => {
    const { tcm } = withConflicts("merge not pushed");
    const root = tempDir("merge not pushed server");
    fs.mkdirSync(path.join(root, "server"));
    okIn(path.join(root, "server"), "init");
    const url = await startServer(keep, path.join(root, "server"), "tok");
    tcm("remote", "add", "origin", url, "--token", "tok");
    assert.match(tcm("push", "origin"), /pushed origin\/s/);

    const b = path.join(root, "b");
    fs.mkdirSync(b);
    okIn(b, "init");
    okIn(b, "remote", "add", "origin", url, "--token", "tok");
    okIn(b, "pull", "origin", "s");
    assert.match(okIn(b, "todo"), /nothing to do/);
    assert.match(okIn(b, "view", "lib.k"), /const a = 10;/);
    assert.match(tcm("todo"), /merging main into s/, "the merge waits here still");
  })

uses