function setupFileWatchers
setupFileWatchers(
testFileLookupPaths: string[],
config: Config,
onEventFunc: (
event: string,
file: string
) => unknown
,
onFinishFunc: ((
path: string,
event: string
) => void) | null | undefined
): { fileWatchers: Record<string, FSWatcher>; killFileWatchers: () => Record<string, FSWatcher>; }

Starts fs.watch watchers for each lookup path and calls onEventFunc on JS/TS file changes, debounced via a flag. Uses config.fsTree to distinguish unlink (tracked file) from unlinkDir (directory) on deletion.

Parameters

testFileLookupPaths: string[]
config: Config
onEventFunc: (
event: string,
file: string
) => unknown
onFinishFunc: ((
path: string,
event: string
) => void) | null | undefined

Return Type

{ fileWatchers: Record<string, FSWatcher>; killFileWatchers: () => Record<string, FSWatcher>; }

Usage

import setupFileWatchers from "lib/setup/file-watcher.ts";