Browse Source

test: reduce sequential/test-fs-watch flakiness

The fs.watch test's write events sometimes aren't produced on OS X,
possibly because of a fsevents race condition. This patch gives delays
the writing a total of 20ms, which makes the test pass consistently.

PR-URL: https://github.com/iojs/io.js/pull/1275
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v1.8.0-commit
Roman Reiss 10 years ago
parent
commit
955c1508da
  1. 6
      test/sequential/test-fs-watch.js

6
test/sequential/test-fs-watch.js

@ -56,7 +56,7 @@ assert.doesNotThrow(
setTimeout(function() { setTimeout(function() {
fs.writeFileSync(filepathOne, 'world'); fs.writeFileSync(filepathOne, 'world');
}, 10); }, 20);
process.chdir(testDir); process.chdir(testDir);
@ -79,7 +79,7 @@ assert.doesNotThrow(
setTimeout(function() { setTimeout(function() {
fs.writeFileSync(filepathTwoAbs, 'pardner'); fs.writeFileSync(filepathTwoAbs, 'pardner');
}, 10); }, 20);
try { fs.unlinkSync(filepathThree); } catch (e) {} try { fs.unlinkSync(filepathThree); } catch (e) {}
try { fs.mkdirSync(testsubdir, 0700); } catch (e) {} try { fs.mkdirSync(testsubdir, 0700); } catch (e) {}
@ -103,7 +103,7 @@ assert.doesNotThrow(
setTimeout(function() { setTimeout(function() {
var fd = fs.openSync(filepathThree, 'w'); var fd = fs.openSync(filepathThree, 'w');
fs.closeSync(fd); fs.closeSync(fd);
}, 10); }, 20);
// https://github.com/joyent/node/issues/2293 - non-persistent watcher should // https://github.com/joyent/node/issues/2293 - non-persistent watcher should
// not block the event loop // not block the event loop

Loading…
Cancel
Save