test: make spawnSync() test robust

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: https://github.com/nodejs/node/pull/2535
Fixes: https://github.com/nodejs/node/issues/2470
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Rich Trott 2015-08-24 21:25:48 -07:00
Родитель b630ebaf43
Коммит 7e63eb7762
1 изменённых файлов: 0 добавлений и 4 удалений

Просмотреть файл

@ -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');