fakeVerify

tcmts.cli.test.e2e.verify.fakeVerify · #cyjrv2z7 · term · runs on the server

uses node:fs

A verify as far as its turns go (verifyTurns), run as a program: once ${log}.go is there, it builds for ms in its own place, and main's then makes what it built the known-good tcm for ms; each step noted in log.

import { verifyTurns } from "#codebase/tcmts/dev";
import fs from "node:fs";
import path from "node:path";

export async function fakeVerify(
  dist: string,
  branch: string,
  ms: string,
  log: string,
): Promise<void> {
  const note = (what: string) => fs.appendFileSync(log, `${Date.now()} ${branch} ${what}\n`);
  const sleep = () => new Promise((r) => setTimeout(r, Number(ms)));
  note("ready");
  while (!fs.existsSync(`${log}.go`)) await new Promise((r) => setTimeout(r, 20));
  const { dir, promote } = await verifyTurns(dist, branch === "main" ? undefined : branch);
  note("build");
  fs.mkdirSync(path.join(dir, "install"), { recursive: true });
  await sleep();
  note("built");
  if (branch !== "main") return;
  const done = await promote();
  note("promote");
  await sleep();
  note("promoted");
  done();
}

uses

used by