From 9518c0e11d56395146d6c3f9d63d31241209ada0 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Tue, 31 Dec 2024 05:42:45 -0800 Subject: [PATCH] Watcher tests - disable flaky test on Windows + Linux Summary: Despite increasing timeouts for this test a few times, we still see failures both in OSS and internal CI. I'm pretty sure there's a race condition in both our own `FallbackWatcher` / `NodeWatcher` *and* Watchman where when recursively watching a subtree, new files are added before a directory is watched or crawled, and so we never see an event for them. This is a problem, but I don't want to entirely lose the signal for this important set of tests due to that flakiness. This skips the problematic test on Windows and Linux until we have a better fix. We haven't observed a problem on macOS IIRC. Changelog: Internal Reviewed By: huntie Differential Revision: D67712965 fbshipit-source-id: 2246d282f7edba8243a4e8922fea13137959cc3f --- .../src/watchers/__tests__/integration-test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/metro-file-map/src/watchers/__tests__/integration-test.js b/packages/metro-file-map/src/watchers/__tests__/integration-test.js index e72d795bf..1d5ba2c28 100644 --- a/packages/metro-file-map/src/watchers/__tests__/integration-test.js +++ b/packages/metro-file-map/src/watchers/__tests__/integration-test.js @@ -34,6 +34,8 @@ describe.each(Object.keys(WATCHERS))( // If all tests are skipped, Jest will not run before/after hooks either. const maybeTest = WATCHERS[watcherName] ? test : test.skip; + const maybeTestOn = (...platforms: $ReadOnlyArray) => + platforms.includes(os.platform()) ? test : test.skip; beforeAll(async () => { watchRoot = await createTempWatchRoot(watcherName); @@ -233,7 +235,9 @@ describe.each(Object.keys(WATCHERS))( }); }); - maybeTest( + /* FIXME: Disabled on Windows and Darwin due to flakiness (occasional + timeouts) - see history. */ + maybeTestOn('darwin')( 'emits deletion for all files when a directory is deleted', async () => { await eventHelpers.allEvents( @@ -267,8 +271,6 @@ describe.each(Object.keys(WATCHERS))( {rejectUnexpected: true}, ); }, - // We see occasional failures in CI with default 5s timeout. - 45000, ); }, );