Skip to content

Commit 788a914

Browse files
committed
fix: windows test failures
1 parent fa9b762 commit 788a914

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

test/test-watcher.browser.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ function _setupTests(testType) {
255255
await _writeTestFile(fileInSameDirNotWatched);
256256

257257
await waitForTrue(()=>{return pathChangeArray.length === 1;},10000);
258-
await _waitForSomeTime(100); // maybe some more events might come in so wait for some time to be sure?
258+
await _waitForSomeTime(1000); // maybe some more events might come in so wait for some time to be sure?
259259
expect(pathChangeArray).to.deep.include({ path: watchPath, watchEvent: CHANGE});
260260
expect(pathChangeArray.length).to.eql(1);
261261
});
@@ -265,7 +265,7 @@ function _setupTests(testType) {
265265
await _creatDirAndValidate(watchPath);
266266
await _creatDirAndValidate(`${watchPath}/anotherPath`);
267267
await _creatDirAndValidate(`${watchPath}/exact`);
268-
await _waitForSomeTime(500); // wait for some watcher events to trickle out maybe due to os delays
268+
await _waitForSomeTime(1000); // wait for some watcher events to trickle out maybe due to os delays
269269

270270
const pathChangeArray = [];
271271

@@ -285,13 +285,21 @@ function _setupTests(testType) {
285285
await _writeTestFile(`${watchPath}/newPath/b.txt`);
286286

287287
const expectedChanges = 5;
288-
await waitForTrue(()=>{return pathChangeArray.length === expectedChanges;},10000);
289-
await _waitForSomeTime(100); // maybe some more events might come in so wait for some time to be sure?
288+
await waitForTrue(()=>{return pathChangeArray.length >= expectedChanges;},100000);
289+
await _waitForSomeTime(1000); // maybe some more events might come in so wait for some time to be sure?
290+
// check inclusions
290291
expect(pathChangeArray).to.deep.include({ path: `${watchPath}/b.txt`, watchEvent: ADD_FILE});
292+
expect(pathChangeArray).to.deep.include({ path: `${watchPath}/anotherPath/exact`, watchEvent: ADD_DIR});
293+
expect(pathChangeArray).to.deep.include({ path: `${watchPath}/anotherPath/file.txt`, watchEvent: ADD_FILE});
291294
expect(pathChangeArray).to.deep.include({ path: `${watchPath}/newPath`, watchEvent: ADD_DIR});
292295
expect(pathChangeArray).to.deep.include({ path: `${watchPath}/newPath/b.txt`, watchEvent: ADD_FILE});
293-
expect(pathChangeArray.length).to.eql(expectedChanges);
294-
}).timeout(10000);
296+
// check exclusions
297+
expect(pathChangeArray).not.to.deep.include({ path: `${watchPath}/ignored_path`, watchEvent: ADD_DIR});
298+
expect(pathChangeArray).not.to.deep.include({ path: `${watchPath}/ignored_path/a.txt`, watchEvent: ADD_FILE});
299+
expect(pathChangeArray).not.to.deep.include({ path: `${watchPath}/anotherPath/ignored_path`, watchEvent: ADD_DIR});
300+
expect(pathChangeArray).not.to.deep.include({ path: `${watchPath}/exact/path`, watchEvent: ADD_DIR});
301+
expect(pathChangeArray).not.to.deep.include({ path: `${watchPath}/exact/file.txt`, watchEvent: ADD_FILE});
302+
}).timeout(100000);
295303

296304
it(`Should phoenix ${testType} watch for file rename`, async function () {
297305
const watchPath = `${testPath}/watch`;

0 commit comments

Comments
 (0)