Skip to content

Commit 83a41be

Browse files
committed
fix: erratic file filter test fails
1 parent 601f975 commit 83a41be

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/spec/FileFilters-integ-test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,17 @@ define(function (require, exports, module) {
486486
"", FileSystem));
487487
await jsPromise(SpecRunnerUtils.createTextFile(`${testPathGitIgnore}/css/.gitignore`,
488488
"foo.css", FileSystem));
489+
490+
// Wait for filesystem changes to propagate before opening search bar.
491+
// When the search bar opens, it caches the file list (FindInFilesUI.js:242) by calling
492+
// ProjectManager.getAllFiles() which performs gitignore filtering during directory traversal.
493+
// We need to ensure gitignore files are fully written and filesystem events have propagated
494+
// before this caching happens, otherwise the cached list won't respect the gitignore rules.
495+
// Note: We tried awaitsFor() with various conditions (checking file readability, DocumentManager
496+
// state, cache updates) but they were not reliable across all platforms.
497+
// A 1-second delay is the most reliable approach for this test for now. @filefilter_delay_explanation
498+
await awaits(1000);
499+
489500
await openSearchBar();
490501

491502
_setNoFilesExcluded();
@@ -503,6 +514,11 @@ define(function (require, exports, module) {
503514
"bar.txt", FileSystem));
504515
await jsPromise(SpecRunnerUtils.createTextFile(`${testPathGitIgnore}/css/.gitignore`,
505516
"foo.css", FileSystem));
517+
518+
// Wait for filesystem changes to propagate before opening search bar. A 1-second delay is
519+
// the most reliable approach for this test. See @filefilter_delay_explanation for explanation
520+
await awaits(1000);
521+
506522
await openSearchBar();
507523

508524
_setNoFilesExcluded();

0 commit comments

Comments
 (0)