setUp

tcmts.cli.test.e2e.vitest.setUp · #jg2supqm · term · runs on the server

uses node:fs

A new codebase with no scratch file.

import { okIn, tcmIn, tempDir } from "#codebase/tcmts/cli/test/e2e/harness";
import fs from "node:fs";
import path from "node:path";

export function setUp() {
  const dir = tempDir("vitest");
  const run = (...args: string[]) => tcmIn(dir, ...args);
  const tcm = (...args: string[]) => okIn(dir, ...args);
  const write = (file: string, text: string) => fs.writeFileSync(path.join(dir, file), text);
  tcm("init");
  fs.rmSync(path.join(dir, "scratch.ts"));
  return { dir, run, tcm, write };
}

uses

used by