Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test for debugger restart message issue
Browse files Browse the repository at this point in the history
Running "restart" in the debugger confusingly prints an out-of-date
"Debugger listening on..." message before printing a second updated one.

Refs: #39272
Trott committed Jul 5, 2021
1 parent e9cf120 commit d91011a
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/known_issues/test-debugger-restart-message.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict';

// Refs: https://github.com/nodejs/node/issues/39272

const common = require('../common');

common.skipIfInspectorDisabled();

const fixtures = require('../common/fixtures');
const startCLI = require('../common/debugger');

const assert = require('assert');

// Using `restart` should result in only one "Connect/For help" message.
{
const script = fixtures.path('debugger', 'three-lines.js');
const cli = startCLI([script]);

function onFatal(error) {
cli.quit();
throw error;
}

const listeningRegExp = /Debugger listening on/g;

cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => {
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
})
.then(() => cli.flushOutput())
.then(() => {
assert.strictEqual(cli.output.match(listeningRegExp), null);
})
.then(() => cli.stepCommand('restart'))
.then(() => {
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
})
.then(() => cli.quit())
.then(null, onFatal);
}

0 comments on commit d91011a

Please sign in to comment.