MCPcopy Create free account
hub / github.com/Effect-TS/effect / importFile

Method importFile

packages/tools/doctest/src/Runner.ts:18–31  ·  view source on GitHub ↗
(filepath: string, source: "collect" | "setup")

Source from the content-addressed store, hash-verified

16export const wrap = (Base: typeof TestRunner): typeof TestRunner => {
17 return class DoctestRunner extends Base {
18 override importFile(filepath: string, source: "collect" | "setup"): unknown {
19 if (source !== "collect") {
20 return super.importFile(filepath, source)
21 }
22
23 return readFile(filepath).then((contents) => {
24 if (!contents.includes("import.meta.vitest")) {
25 return super.importFile(filepath, source)
26 }
27
28 const version = createHash("sha256").update(contents).digest("hex").slice(0, 16)
29 return super.importFile(Protocol.collectorId(filepath, version), source)
30 })
31 }
32 }
33}
34

Callers

nothing calls this directly

Calls 3

digestMethod · 0.80
readFileFunction · 0.50
updateMethod · 0.45

Tested by

no test coverage detected