Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: never watch node_modules (#30514)

Pavel Feldman7a9fd27146b3
diff --git a/packages/playwright/src/fsWatcher.ts b/packages/playwright/src/fsWatcher.ts
index 749c11ab0b..c0d4e4d04e 100644
--- a/packages/playwright/src/fsWatcher.ts
+++ b/packages/playwright/src/fsWatcher.ts
@@ -16,6 +16,7 @@
import { chokidar } from './utilsBundle';
import type { FSWatcher } from 'chokidar';
+import path from 'path';
export type FSEvent = { event: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', file: string };
@@ -51,7 +52,8 @@ export class Watcher {
if (!this._watchedFiles.length)
return;
- this._fsWatcher = chokidar.watch(watchedFiles, { ignoreInitial: true, ignored: this._ignoredFolders }).on('all', async (event, file) => {
+ const ignored = [...this._ignoredFolders, (name: string) => name.includes(path.sep + 'node_modules' + path.sep)];
+ this._fsWatcher = chokidar.watch(watchedFiles, { ignoreInitial: true, ignored }).on('all', async (event, file) => {
if (this._throttleTimer)
clearTimeout(this._throttleTimer);
if (this._mode === 'flat' && event !== 'add' && event !== 'change')