(filePath: string, content: string)
| 32 | afterEach(() => fs.removeSync(watchedFileOut)); |
| 33 | |
| 34 | async 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 | |
| 50 | test("should watch single file", async () => { |
| 51 | forkWatchProcess([path.join(__dirname, "./watch/watch.ts")]); |
no test coverage detected