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