Skip to content

test(watch): synchronize filesystem event assertions - #60

Open
calvin-archastro wants to merge 2 commits into
mainfrom
fix/watcher-test-synchronization
Open

test(watch): synchronize filesystem event assertions#60
calvin-archastro wants to merge 2 commits into
mainfrom
fix/watcher-test-synchronization

Conversation

@calvin-archastro

Copy link
Copy Markdown
Contributor

Summary

Removes fixed-duration sleep synchronization from two watcher tests that were racing against real filesystem event delivery.

  1. src/watch/event_loop.rs — the mid-build cooldown test slept a flat 450ms and then asserted the dispatch count. Replaced with a wait_until poll (3s ceiling) so the test waits for the second dispatch rather than guessing when it lands. Snapshot is captured once and reused in both the assertion and the failure message.
  2. tests/watch_tests.rswatch_ignores_node_modules_changes pre-created node_modules/foo/index.js before the watcher started, so it only ever exercised the modify path. Now the file is created after startup, modeling a dependency install and asserting the entire directory creation stays ignored.

Notes

  • Assertions use inline format args ({snapshot:?}) to stay MSRV-compatible with the rest of the suite.
  • No production code changes — test-only.

Test plan

  • cargo test --lib watch::event_loop
  • cargo test --test watch_tests

🤖 Generated with Claude Code

@calvin-archastro
calvin-archastro requested a review from a team August 21, 2026 15:48
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.

1 participant