-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
test: fix flaky test-force-repl #8484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,18 @@ | ||
| 'use strict'; | ||
| var common = require('../common'); | ||
| var assert = require('assert'); | ||
| var spawn = require('child_process').spawn; | ||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
| const spawn = require('child_process').spawn; | ||
|
|
||
| // spawn a node child process in "interactive" mode (force the repl) | ||
| var cp = spawn(process.execPath, ['-i']); | ||
| var gotToEnd = false; | ||
| const cp = spawn(process.execPath, ['-i']); | ||
| var timeoutId = setTimeout(function() { | ||
| throw new Error('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.once('data', function(b) { | ||
| cp.stdout.once('dasta', common.mustCall(function(b) { | ||
| clearTimeout(timeoutId); | ||
| assert.equal(b, '> '); | ||
|
||
| gotToEnd = true; | ||
| cp.kill(); | ||
| }); | ||
|
|
||
| process.on('exit', function() { | ||
| assert(gotToEnd); | ||
| }); | ||
| })); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dasta?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! I added that to make sure the test fails if the callback never fired but then checked it in that way by accident.