Skip to content

lib: adding --watch-pattern to support watching files/dirs with glob#59345

Open
louiellan wants to merge 5 commits intonodejs:mainfrom
louiellan:glob-on-watch-path
Open

lib: adding --watch-pattern to support watching files/dirs with glob#59345
louiellan wants to merge 5 commits intonodejs:mainfrom
louiellan:glob-on-watch-path

Conversation

@louiellan
Copy link
Copy Markdown

@louiellan louiellan commented Aug 4, 2025

Closes #45182

This adds the --watch-pattern cli option to Node.js, which allows to watch files and directories with the use of globs. This PR is a non-breaking change opposed to --watch-path option supporting globs since there could be instances where some glob characters are used (e.g., file[1].js) which could be treated as a glob and may cause breakage on existing scripts.

@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 Aug 4, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.36%. Comparing base (55b7d28) to head (bf21496).
⚠️ Report is 49 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59345      +/-   ##
==========================================
- Coverage   89.97%   89.36%   -0.61%     
==========================================
  Files         649      654       +5     
  Lines      192189   192701     +512     
  Branches    37679    37461     -218     
==========================================
- Hits       172915   172212     -703     
- Misses      11864    13004    +1140     
- Partials     7410     7485      +75     
Files with missing lines Coverage Δ
lib/internal/fs/glob.js 90.72% <100.00%> (-1.27%) ⬇️

... and 115 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.

@louiellan louiellan force-pushed the glob-on-watch-path branch from 0c53c42 to 46be19d Compare August 5, 2025 03:14
Comment thread lib/internal/main/watch_mode.js Outdated
Co-authored-by: Moshe Atlow <moshe@atlow.co.il>
@louiellan louiellan marked this pull request as draft August 12, 2025 02:02
@louiellan louiellan changed the title lib: support globs on --watch-path lib: adding --watch-pattern to support watching files/dirs with glob Aug 15, 2025
@louiellan
Copy link
Copy Markdown
Author

I've added another PR for supporting glob on --watch-path option #59478 just in case if it is ever decided that we would go through with the breaking change

@louiellan louiellan marked this pull request as ready for review August 15, 2025 04:45
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

@github-actions github-actions bot added the stale label Apr 19, 2026
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. stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support file globs with --watch-path

3 participants