tcmts.cli.vitest

Types

Request type
TestEntry type
VitestLike type

Server

keysForResults (cb: Codebase, hashes: Iterable<string>, src?: DefSource | undefined) => Map<string, string>
The keys tests' results are kept under, by hash: the runtime and the test framework (`resultKey`), and the platform too (`darwin-arm64`) for a test whose code reaches files, the environment or other processes, which differ from one to another. A result travels to another machine only under its own key.
linkModules (dir: string, cache: string, plain: Record<string, string>) => void
The test root's node_modules: everything in the cache (the pinned aliases generated modules import), plus the test tools under their own names, which Vitest's browser mode looks them up by.
packagesKey (cb: Codebase, request: Request) => string
The npm packages a run's browser tests reach (through all the code they use), and Vitest's: what names the bundle Vite makes of them for the browser (`vitestChild`), kept from one run to the next, so an edit that imports nothing new reuses it.
prepareTestRun (cb: Codebase, tests: { hash: string; componentHash: string; }[], src: DefSource) => { requestFile:…
Prepare a Vitest run of these tests: the request a child tcm process runs (`tcm internal-vitest <file>`), and where its results will be. The debugger runs it too, under its own control.
resultKey (cb: Codebase) => string
The key test results are cached under: the runtime and the test framework that produced them.
runTestsWithVitest (cb: Codebase, tests: { hash: string; componentHash: string; }[], src: DefSource) => TestRun[]
Run test definitions with Vitest: in Node, or in a browser for tests that need one.
strip (s: string) => string
vitestChild (requestFile: string) => Promise<void>
The child side: run the request's tests with Vitest, write their results.
vitestModule (dir: string, cacheDir: string, vitestImport: string, tests: TestEntry[]) => string
One generated Vitest file: each test definition as a `test()`, named by its hash.

Shared

PLATFORM_BOUND readonly Effect[]
What a test can reach that differs between machines of one runtime: its result is kept for the platform too.
TEST_TIMEOUT_MS 10000