testToolsRunAnOlderBuild

tcmts.cli.mcp.testToolsRunAnOlderBuild · #yfrstqyx · term

tcm_cli's build runs the command with a kept build (tcm --build), on a repro's codebase with cwd; tcm_test's bin takes a build's name as it does a tcm.js.

import { TOOLS } from "#codebase/tcmts/cli/mcp";
import assert from "node:assert/strict";

export const testToolsRunAnOlderBuild = () => {
  const cli = TOOLS.find((t) => t.name === "tcm_cli")!.argv!;
  assert.deepEqual(cli({ args: ["view", "x"], build: "previous", cwd: "/tmp/repro" }), [
    "--build",
    "previous",
    "-C",
    "/tmp/repro",
    "view",
    "x",
  ]);
  assert.deepEqual(cli({ args: ["status"], build: "known-good" }), [
    "--build",
    "known-good",
    "status",
  ]);
  assert.throws(
    () => cli({ args: ["status"], build: "previous", live: true }),
    /`build` or `live`/,
  );
  const test = TOOLS.find((t) => t.name === "tcm_test")!.argv!;
  assert.deepEqual(test({ names: ["lib.e2e"], bin: { tcm: "previous" } }), [
    "test",
    "lib.e2e",
    "--bin",
    "tcm=previous",
  ]);
}

uses