Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 96bdfae

Browse filesBrowse files
santigimenoMyles Borins
authored andcommitted
test: improve test-debugger-util-regression
Avoid the `exit` command to be sent more than once. It prevents from undesired errors emitted on `proc.stdin`. Remove the watchdog timer so the test does not fail in case it takes longer to complete. PR-URL: #9490 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James Snell <jasnell@gmail.com>
1 parent c5181ed commit 96bdfae
Copy full SHA for 96bdfae

File tree

Expand file treeCollapse file tree

1 file changed

+3
-17
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-17
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-debugger-util-regression.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-debugger-util-regression.js
+3-17Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,11 @@ const proc = spawn(process.execPath, args, { stdio: 'pipe' });
1919
proc.stdout.setEncoding('utf8');
2020
proc.stderr.setEncoding('utf8');
2121

22-
function fail() {
23-
common.fail('the program should not hang');
24-
}
25-
26-
const timer = setTimeout(fail, common.platformTimeout(4000));
27-
2822
let stdout = '';
2923
let stderr = '';
3024

3125
let nextCount = 0;
26+
let exit = false;
3227

3328
proc.stdout.on('data', (data) => {
3429
stdout += data;
@@ -38,8 +33,8 @@ proc.stdout.on('data', (data) => {
3833
stdout.includes('> 4') && nextCount < 4) {
3934
nextCount++;
4035
proc.stdin.write('n\n');
41-
} else if (stdout.includes('{ a: \'b\' }')) {
42-
clearTimeout(timer);
36+
} else if (!exit && (stdout.includes('< { a: \'b\' }'))) {
37+
exit = true;
4338
proc.stdin.write('.exit\n');
4439
} else if (stdout.includes('program terminated')) {
4540
// Catch edge case present in v4.x
@@ -50,15 +45,6 @@ proc.stdout.on('data', (data) => {
5045

5146
proc.stderr.on('data', (data) => stderr += data);
5247

53-
// FIXME
54-
// This test has been periodically failing on certain systems due to
55-
// uncaught errors on proc.stdin. This will stop the process from
56-
// exploding but is still not an elegant solution. Likely a deeper bug
57-
// causing this problem.
58-
proc.stdin.on('error', (err) => {
59-
console.error(err);
60-
});
61-
6248
process.on('exit', (code) => {
6349
assert.equal(code, 0, 'the program should exit cleanly');
6450
assert.equal(stdout.includes('{ a: \'b\' }'), true,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.