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 8ce21f1 commit e69ec73
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/sequential/test-debugger-breakpoint-exists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'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.waitFor(/listening/))
.then(() => cli.waitFor(/attached/))
.then(() => cli.waitFor(/Break on/))
.then(() => cli.waitForPrompt())
.then(() => cli.command('setBreakpoint(1)'))
.then(() => cli.command('restart'))
.then(() => cli.waitFor(/listening/))
.then(() => cli.waitFor(/attached/))
.then(() => cli.waitFor(/Break on/))
.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 e69ec73

Please sign in to comment.