testBriefOutputKeepsOneWaitingLineOrTheTotal

tcmts.cli.mcp.testBriefOutputKeepsOneWaitingLineOrTheTotal · #4i7bnnj5 · term

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

export const testBriefOutputKeepsOneWaitingLineOrTheTotal = () => {
  const out = [
    "waiting for 2 slots: 6 of 6 in use (6 by session/a) (TCM_SLOTS sets how many)",
    "still waiting for 2 slots after 1m: 6 of 6 in use (6 by session/b)",
    "got 2 slots after 1m30s",
    "  ✓ lib.testA  1ms",
    "  ✗ lib.testB  3ms",
    "      AssertionError: 1 !== 2",
    "",
    "1 passed, 1 failed",
    "",
    "suites (running tcm)",
    "waiting for a slot: 6 of 6 in use (6 by session/a) (TCM_SLOTS sets how many)",
    "  ✓ lib.e2e.testC  20ms",
    "still waiting for a slot after 1m: 6 of 6 in use (6 by session/b)",
    "got a slot after 1m10s",
    "  ✗ lib.e2e.testD  20ms",
    "      AssertionError: 3 !== 4",
    "",
    "suites: 1 passed, 1 failed, 2m waiting for slots",
  ].join("\n");
  // test definitions: their last waiting line, above the summary; suites: the summary's total alone; failures kept
  assert.equal(
    briefOutput(["test"], out),
    [
      "✗ lib.testB  3ms",
      "      AssertionError: 1 !== 2",
      "",
      "ran: lib.testA",
      "got 2 slots after 1m30s",
      "1 passed, 1 failed",
      "",
      "suites (running tcm)",
      "  ✗ lib.e2e.testD  20ms",
      "      AssertionError: 3 !== 4",
      "",
      "ran: lib.e2e.testC",
      "suites: 1 passed, 1 failed, 2m waiting for slots",
    ].join("\n"),
  );
  // a run still going: only the wait as it is now
  assert.equal(
    briefOutput(["test"], out.split("\n").slice(9, 13).join("\n")),
    "suites (running tcm)\nstill waiting for a slot after 1m: 6 of 6 in use (6 by session/b)",
  );
}

uses