testUnnamedCodeOfATestsOwnCodebaseIsntThisOnes
Code no name follows that ran only from another codebase's cache (one a test made, holding code this codebase once
had: tcm init's) is that codebase's, not this one's: it doesn't stop the run being kept.
import { coveredRun, SOURCE } from "#codebase/tcmts/cli/suites/test"; import assert from "node:assert/strict"; import fs from "node:fs"; import os from "node:os"; import path from "node:path"; export const testUnnamedCodeOfATestsOwnCodebaseIsntThisOnes = () => { const { cb, def, executedBy } = coveredRun(SOURCE); const main = def("main").hash; const named = cb.store.pathsOf.bind(cb.store); cb.store.pathsOf = (h: string) => (h === main ? [] : named(h)); const theirs = path.join(fs.mkdtempSync(path.join(os.tmpdir(), "tcm-theirs-")), ".tcm", "cache"); const out = executedBy( undefined, [ ["main", "main"], ["double", "double"], ], theirs, )!; assert.ok(out && !("main" in out) && "double" in out); }