MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / compileChangeAndCompare

Function compileChangeAndCompare

test/cli/watch.spec.ts:34–48  ·  view source on GitHub ↗
(filePath: string, content: string)

Source from the content-addressed store, hash-verified

32afterEach(() => fs.removeSync(watchedFileOut));
33
34async function compileChangeAndCompare(filePath: string, content: string): Promise<void> {
35 await waitForFileExists(watchedFileOut);
36 const initialResultLua = fs.readFileSync(watchedFileOut, "utf8");
37
38 fs.unlinkSync(watchedFileOut);
39
40 const originalContent = fs.readFileSync(filePath, "utf8");
41 fs.writeFileSync(filePath, content);
42 testsCleanup.push(() => fs.writeFileSync(filePath, originalContent));
43
44 await waitForFileExists(watchedFileOut);
45 const updatedResultLua = fs.readFileSync(watchedFileOut, "utf8");
46
47 expect(initialResultLua).not.toEqual(updatedResultLua);
48}
49
50test("should watch single file", async () => {
51 forkWatchProcess([path.join(__dirname, "./watch/watch.ts")]);

Callers 1

watch.spec.tsFile · 0.85

Calls 2

waitForFileExistsFunction · 0.85
expectFunction · 0.85

Tested by

no test coverage detected