Skip to content

Conversation

@mcollina
Copy link
Member

Add an ignore option to fs.watch() to filter filesystem events.

Type: string | RegExp | Function | Array<string | RegExp | Function>

fs.watch(dir, { ignore: '*.log' });
fs.watch(dir, { ignore: /\.tmp$/ });
fs.watch(dir, { ignore: (f) => f.startsWith('.') });
fs.watch(dir, { ignore: ['*.log', /\.tmp$/] });

Add an `ignore` option to `fs.watch()` to filter filesystem events.
Supports string globs, RegExp, functions, or arrays of these.
@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Jan 18, 2026
@mcollina mcollina marked this pull request as ready for review January 18, 2026 23:29
@mcollina mcollina requested review from aduh95 and anonrig and removed request for anonrig January 18, 2026 23:30
mohmedsa22242-cell

This comment was marked as spam.

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.53%. Comparing base (637bda0) to head (cbcd51e).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61433      +/-   ##
==========================================
+ Coverage   88.51%   88.53%   +0.02%     
==========================================
  Files         704      704              
  Lines      208883   209004     +121     
  Branches    40334    40371      +37     
==========================================
+ Hits       184890   185049     +159     
+ Misses      15977    15928      -49     
- Partials     8016     8027      +11     
Files with missing lines Coverage Δ
lib/fs.js 98.19% <100.00%> (+<0.01%) ⬆️
lib/internal/fs/recursive_watch.js 85.01% <100.00%> (+0.65%) ⬆️
lib/internal/fs/watchers.js 87.37% <100.00%> (+2.20%) ⬆️
lib/internal/validators.js 98.25% <100.00%> (+0.09%) ⬆️

... and 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 19, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 19, 2026
@nodejs-github-bot
Copy link
Collaborator

Use setInterval instead of setTimeout to handle potential event delays
on macOS FSEvents. This ensures that if a write event is missed due to
event coalescing or latency, subsequent writes will eventually trigger
the expected event.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants