Skip to content

[WIP] fix: watch mode using chokidar v4 (#5355) #5379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Arnesfield
Copy link

Glob paths are no longer supported by chokidar starting at v4.

This update works around this by resolving watchFiles and watchIgnore to valid paths and creating a list of matchers to determine if the files should be allowed or ignored through the chokidar ignored match function.

This commit reverts changes from 8af0f1a so that the watched file changes are not fixed to the current directory.

Additional note: when a watchFile path is removed while chokidar is watching it, recreating the watchFile path does not trigger events from chokidar to rerun the tests.

PR Checklist

Overview

Glob paths are no longer supported by chokidar starting at v4.

This update works around this by resolving `watchFiles` and `watchIgnore`
to valid paths and creating a list of matchers to determine if the files
should be allowed or ignored through the chokidar `ignored` match function.

This commit reverts changes from 8af0f1a
so that the watched file changes are not fixed to the current directory.

Additional note: when a `watchFile` path is removed while chokidar is
watching it, recreating the `watchFile` path does not trigger events
from chokidar to rerun the tests.
Copy link

linux-foundation-easycla bot commented Jun 18, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

@Arnesfield Arnesfield changed the title fix: watch mode using chokidar v4 (#5355) [WIP] fix: watch mode using chokidar v4 (#5355) Jun 18, 2025
@Arnesfield
Copy link
Author

Might need to rethink this a bit. Currently, running into some issues:

  • The test reruns test when file matching --watch-files is added doesn't pass
  • The watchFiles for this test are: **/*.xyz
  • From what I understand, the actual test result looks like it has an additional rerun (3 instead of the expected 2) which I think is probably due to the directory being created (lib/ then lib/file.xyz)
  • But ignoring the directory in chokidar means its contents are also ignored
  • Need a way to not ignore a directory (lib) but also only allow contents to trigger a rerun (*.xyz)

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft June 18, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug: watching files outside of CWD is broken
1 participant