2021-07-05 14:55:49 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
|
2021-07-10 01:19:41 +00:00
|
|
|
common.skipIfInspectorDisabled();
|
2021-07-05 14:55:49 +00:00
|
|
|
|
2021-07-10 01:19:41 +00:00
|
|
|
const assert = require('assert');
|
2021-07-05 14:55:49 +00:00
|
|
|
|
2021-07-10 01:19:41 +00:00
|
|
|
const RESTARTS = 10;
|
2021-07-05 14:55:49 +00:00
|
|
|
|
|
|
|
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');
|
2023-03-27 22:03:40 +00:00
|
|
|
const cli = startCLI(['--port=0', script]);
|
2021-07-05 14:55:49 +00:00
|
|
|
|
|
|
|
const listeningRegExp = /Debugger listening on/g;
|
|
|
|
|
2022-09-29 09:15:32 +00:00
|
|
|
async function onWaitForInitialBreak() {
|
|
|
|
try {
|
|
|
|
await cli.waitForInitialBreak();
|
|
|
|
await cli.waitForPrompt();
|
2021-07-05 14:55:49 +00:00
|
|
|
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
|
2022-09-29 09:15:32 +00:00
|
|
|
|
2021-07-05 14:55:49 +00:00
|
|
|
for (let i = 0; i < RESTARTS; i++) {
|
|
|
|
await cli.stepCommand('restart');
|
|
|
|
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
|
|
|
|
}
|
2022-09-29 09:15:32 +00:00
|
|
|
} finally {
|
|
|
|
await cli.quit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onWaitForInitialBreak();
|
2021-07-05 14:55:49 +00:00
|
|
|
}
|