forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest-debugger-restart-message.js
More file actions
39 lines (28 loc) · 985 Bytes
/
test-debugger-restart-message.js
File metadata and controls
39 lines (28 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const assert = require('assert');
const RESTARTS = 10;
const fixtures = require('../common/fixtures');
const startCLI = require('../common/debugger');
// Using `restart` should result in only one "Connect/For help" message.
{
const script = fixtures.path('debugger', 'three-lines.js');
const cli = startCLI([script]);
const listeningRegExp = /Debugger listening on/g;
async function onWaitForInitialBreak() {
try {
await cli.waitForInitialBreak();
await cli.waitForPrompt();
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
for (let i = 0; i < RESTARTS; i++) {
await cli.stepCommand('restart');
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
}
} finally {
await cli.quit();
}
assert.doesNotMatch(cli.stderrOutput, /MaxListenersExceededWarning/);
}
onWaitForInitialBreak();
}