Browse Source
test: fix flaky test-force-repl-with-eval
Remove the timer just in case the test takes longer to complete.
PR-URL: https://github.com/nodejs/node/pull/9460
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
v6
Santiago Gimeno
8 years ago
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE
1 changed files with
1 additions and
5 deletions
test/parallel/test-force-repl-with-eval.js
@ -1,14 +1,11 @@
'use strict' ;
'use strict' ;
const common = require ( '../common' ) ;
require ( '../common' ) ;
const assert = require ( 'assert' ) ;
const assert = require ( 'assert' ) ;
const spawn = require ( 'child_process' ) . spawn ;
const spawn = require ( 'child_process' ) . spawn ;
// spawn a node child process in "interactive" mode (force the repl) and eval
// spawn a node child process in "interactive" mode (force the repl) and eval
const cp = spawn ( process . execPath , [ '-i' , '-e' , 'console.log("42")' ] ) ;
const cp = spawn ( process . execPath , [ '-i' , '-e' , 'console.log("42")' ] ) ;
var gotToEnd = false ;
var gotToEnd = false ;
const timeoutId = setTimeout ( function ( ) {
throw new Error ( 'timeout!' ) ;
} , common . platformTimeout ( 1000 ) ) ; // give node + the repl 1 second to boot up
cp . stdout . setEncoding ( 'utf8' ) ;
cp . stdout . setEncoding ( 'utf8' ) ;
@ -16,7 +13,6 @@ var output = '';
cp . stdout . on ( 'data' , function ( b ) {
cp . stdout . on ( 'data' , function ( b ) {
output += b ;
output += b ;
if ( output === '> 42\n' ) {
if ( output === '> 42\n' ) {
clearTimeout ( timeoutId ) ;
gotToEnd = true ;
gotToEnd = true ;
cp . kill ( ) ;
cp . kill ( ) ;
}
}