setUp
uses node:fs
A new codebase, with ui.tsx (a JSX component and a function with a warning each) written to it.
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("lint"); 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")); write("ui.tsx", `// tcm: namespace ui\nexport function Pic({ src }: { src: string }) {\n return <img src={src} />;\n}\n\nexport const half = (n: number): number => {\n debugger;\n return n / 2;\n};\n`); return { dir, run, tcm, write }; }