( options: WatchOptions | undefined, resolvedOutDirs: Set<string>, emptyOutDir: boolean, cacheDir: string, )
| 49 | } |
| 50 | |
| 51 | export function resolveChokidarOptions( |
| 52 | options: WatchOptions | undefined, |
| 53 | resolvedOutDirs: Set<string>, |
| 54 | emptyOutDir: boolean, |
| 55 | cacheDir: string, |
| 56 | ): WatchOptions { |
| 57 | const { ignored: ignoredList, ...otherOptions } = options ?? {} |
| 58 | const ignored: WatchOptions['ignored'] = [ |
| 59 | '**/.git/**', |
| 60 | '**/node_modules/**', |
| 61 | '**/test-results/**', // Playwright |
| 62 | escapePath(cacheDir) + '/**', |
| 63 | ...arraify(ignoredList || []), |
| 64 | ] |
| 65 | if (emptyOutDir) { |
| 66 | ignored.push( |
| 67 | ...[...resolvedOutDirs].map((outDir) => escapePath(outDir) + '/**'), |
| 68 | ) |
| 69 | } |
| 70 | |
| 71 | const resolvedWatchOptions: WatchOptions = { |
| 72 | ignored, |
| 73 | ignoreInitial: true, |
| 74 | ignorePermissionErrors: true, |
| 75 | ...otherOptions, |
| 76 | } |
| 77 | |
| 78 | return resolvedWatchOptions |
| 79 | } |
| 80 | |
| 81 | export function convertToWatcherOptions( |
| 82 | options: WatchOptions | undefined, |
no test coverage detected