Skip to content

Commit 3f7f113

Browse files
committed
Stabilize tests when running on Travis/darwin
Running the tests and opening/closing watchers too quickly on underpowered CI VMs causes problems.
1 parent b427e9c commit 3f7f113

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,16 @@ beforeEach(function() {
7777
fixturesPath = getFixturePath('');
7878
});
7979

80-
function closeWatchers() {
80+
function closeWatchers(done) {
8181
var u;
8282
while (u = usedWatchers.pop()) u.close();
83+
if (done) {
84+
process.env.TRAVIS && os === 'darwin' ? setTimeout(done, 500) : done();
85+
}
8386
}
8487
function disposeWatcher(watcher) {
8588
if (!watcher || !watcher.close) return;
86-
osXFsWatch ? usedWatchers.push(watcher) : watcher.close();
89+
os === 'darwin' ? usedWatchers.push(watcher) : watcher.close();
8790
}
8891
afterEach(function() {
8992
disposeWatcher(watcher);
@@ -172,7 +175,7 @@ function runTests(baseopts) {
172175
waitFor([readySpy], function() {
173176
readySpy.should.have.been.calledOnce;
174177
rawSpy = undefined;
175-
done()
178+
closeWatchers(done);
176179
});
177180
});
178181
it('should produce an instance of chokidar.FSWatcher', function() {

0 commit comments

Comments
 (0)