test: refactor fs-watch tests due to macOS issue
In macOS, fsevents generated immediately before start watching may leak into the event callback. See: https://github.com/nodejs/node/issues/54450 for an explanation. This might be fixed at some point in libuv though it may take some time (see: https://github.com/libuv/libuv/issues/3866). This commit comes in anticipation of the soon-to-be-released [email protected] which was making these tests very flaky.
CI: https://ci.nodejs.org/job/node-test-pull-request/61350/
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 87.33%. Comparing base (
cc26951) to head (60e5173). Report is 149 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #54498 +/- ##
==========================================
- Coverage 87.34% 87.33% -0.02%
==========================================
Files 649 649
Lines 182544 182524 -20
Branches 35030 35023 -7
==========================================
- Hits 159445 159402 -43
- Misses 16372 16385 +13
- Partials 6727 6737 +10
CI: https://ci.nodejs.org/job/node-test-pull-request/61410/
CI: https://ci.nodejs.org/job/node-test-pull-request/61553/
Landed in b345118e1e4960e8dcfa0dd5797f91dc4c4565e1