| 72 | // Inert by default — unit tests drive events via __emitWatchEventForTests |
| 73 | // and never depend on real OS watch delivery. |
| 74 | const newWatcher = ( |
| 75 | syncFn: SyncFn, |
| 76 | opts: WatchOptions = {}, |
| 77 | isFileStateCurrent?: (relativePath: string) => boolean |
| 78 | ) => { |
| 79 | const watcher = new FileWatcher(testDir, syncFn, { inertForTests: true, ...opts }, isFileStateCurrent); |
| 80 | unitWatchers.add(watcher); |
| 81 | return watcher; |
| 82 | }; |
| 83 | |
| 84 | beforeEach(() => { |
| 85 | testDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-watcher-')); |