MCPcopy Create free account
hub / github.com/observablehq/framework / testFile

Function testFile

test/javascript/transpile-test.ts:98–102  ·  view source on GitHub ↗
(target: string, path: string)

Source from the content-addressed store, hash-verified

96});
97
98async function testFile(target: string, path: string): Promise<string> {
99 const input = `import {FileAttachment} from "observablehq:stdlib";\nFileAttachment(${JSON.stringify(target)})`;
100 const output = await transpileModule(input, {root: "src", path});
101 return output.split("\n").pop()!;
102}
103
104describe("transpileModule(input, root, path, sourcePath)", () => {
105 it("rewrites relative files with import.meta.resolve", async () => {

Callers 1

transpile-test.tsFile · 0.85

Calls 1

transpileModuleFunction · 0.85

Tested by

no test coverage detected