Skip to content

Commit d91011a

Browse files
committed
test: add test for debugger restart message issue
Running "restart" in the debugger confusingly prints an out-of-date "Debugger listening on..." message before printing a second updated one. Refs: #39272
1 parent e9cf120 commit d91011a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'use strict';
2+
3+
// Refs: https://github.com/nodejs/node/issues/39272
4+
5+
const common = require('../common');
6+
7+
common.skipIfInspectorDisabled();
8+
9+
const fixtures = require('../common/fixtures');
10+
const startCLI = require('../common/debugger');
11+
12+
const assert = require('assert');
13+
14+
// Using `restart` should result in only one "Connect/For help" message.
15+
{
16+
const script = fixtures.path('debugger', 'three-lines.js');
17+
const cli = startCLI([script]);
18+
19+
function onFatal(error) {
20+
cli.quit();
21+
throw error;
22+
}
23+
24+
const listeningRegExp = /Debugger listening on/g;
25+
26+
cli.waitForInitialBreak()
27+
.then(() => cli.waitForPrompt())
28+
.then(() => {
29+
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
30+
})
31+
.then(() => cli.flushOutput())
32+
.then(() => {
33+
assert.strictEqual(cli.output.match(listeningRegExp), null);
34+
})
35+
.then(() => cli.stepCommand('restart'))
36+
.then(() => {
37+
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
38+
})
39+
.then(() => cli.quit())
40+
.then(null, onFatal);
41+
}

0 commit comments

Comments
 (0)