Skip to content

Commit

Permalink
test: make spawnSync() test robust
Browse files Browse the repository at this point in the history
The test had checked that a timer fired within a period after
spawnSync() returns. The result was a test that sometimes was
flaky.

Because there's no guarantee of how long a timer will take
before running, remove the check. There is a check that the
timer runs after spawnSync() so that is sufficient.

PR-URL: #2535
Fixes: #2470
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
Trott authored and rvagg committed Aug 26, 2015
1 parent f2f0fe4 commit 856baf4
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions test/parallel/test-child-process-spawnsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ var spawnSync = require('child_process').spawnSync;
var TIMER = 100;
var SLEEP = 1000;

var timeout = 0;

setTimeout(function() {
timeout = process.hrtime(start);
assert.ok(stop, 'timer should not fire before process exits');
assert.strictEqual(timeout[0], 1, 'timer should take as long as sleep');
}, TIMER);

console.log('sleep started');
Expand Down

0 comments on commit 856baf4

Please sign in to comment.