mirror of https://github.com/lukechilds/node.git
Browse Source
Increase time allowed for startup from 1 second to 5 seconds to avoid occasional flakiness. While at it, refactor a few minor things such as var->const and using common.mustCall(). Fixes: https://github.com/nodejs/node/issues/8483 PR-URL: https://github.com/nodejs/node/pull/8484 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>v4.x
Rich Trott
8 years ago
committed by
Myles Borins
1 changed files with 9 additions and 15 deletions
@ -1,24 +1,18 @@ |
|||||
'use strict'; |
'use strict'; |
||||
var common = require('../common'); |
const common = require('../common'); |
||||
var assert = require('assert'); |
const assert = require('assert'); |
||||
var spawn = require('child_process').spawn; |
const spawn = require('child_process').spawn; |
||||
|
|
||||
// spawn a node child process in "interactive" mode (force the repl)
|
// spawn a node child process in "interactive" mode (force the repl)
|
||||
var cp = spawn(process.execPath, ['-i']); |
const cp = spawn(process.execPath, ['-i']); |
||||
var gotToEnd = false; |
|
||||
var timeoutId = setTimeout(function() { |
var timeoutId = setTimeout(function() { |
||||
throw new Error('timeout!'); |
common.fail('timeout!'); |
||||
}, common.platformTimeout(1000)); // give node + the repl 1 second to boot up
|
}, common.platformTimeout(5000)); // give node + the repl 5 seconds to start
|
||||
|
|
||||
cp.stdout.setEncoding('utf8'); |
cp.stdout.setEncoding('utf8'); |
||||
|
|
||||
cp.stdout.once('data', function(b) { |
cp.stdout.once('data', common.mustCall(function(b) { |
||||
clearTimeout(timeoutId); |
clearTimeout(timeoutId); |
||||
assert.equal(b, '> '); |
assert.strictEqual(b, '> '); |
||||
gotToEnd = true; |
|
||||
cp.kill(); |
cp.kill(); |
||||
}); |
})); |
||||
|
|
||||
process.on('exit', function() { |
|
||||
assert(gotToEnd); |
|
||||
}); |
|
||||
|
Loading…
Reference in new issue