Skip to content

Commit

Permalink
test: add test-debugger-breakpint-exists
Browse files Browse the repository at this point in the history
In Node.js 15, calling `setBreakpoint(1)` and `restart` twice in a row
caused the debugger to exit. In Node.js 16, it no longer exits but
throws an error that is expected, or at least reasonable, or at least
better than exiting.

The error message previously had `undefined` appended to it. It no
longer does.

This adds test coverage to `unpackError()` in
`lib/internal/debugger/inspect_client.js`. That function previously was
untested.

Refs: https://github.com/nodejs/node-inspect/issues/101
  • Loading branch information
Trott committed Jul 29, 2021
1 parent 70e865c commit 9cd7913
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/sequential/test-debugger-breakpoint-exists.js
@@ -0,0 +1,31 @@
'use strict';

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

common.skipIfInspectorDisabled();

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

// Test for "Breakpoint at specified location already exists" error.
{
const script = fixtures.path('debugger', 'three-lines.js');
const cli = startCLI([script]);

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

cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => cli.command('setBreakpoint(1)'))
.then(() => cli.command('restart'))
.then(() => cli.waitForInitialBreak())
.then(() => cli.waitForPrompt())
.then(() => cli.command('setBreakpoint(1)'))
.then(() => cli.command('restart'))
.then(() => cli.waitFor(/Breakpoint at specified location already exists/))
.then(() => cli.quit())
.then(null, onFatal);
}

0 comments on commit 9cd7913

Please sign in to comment.