Skip to content

Commit 9cd7913

Browse files
committed
test: add test-debugger-breakpint-exists
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
1 parent 70e865c commit 9cd7913

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
5+
common.skipIfInspectorDisabled();
6+
7+
const fixtures = require('../common/fixtures');
8+
const startCLI = require('../common/debugger');
9+
10+
// Test for "Breakpoint at specified location already exists" error.
11+
{
12+
const script = fixtures.path('debugger', 'three-lines.js');
13+
const cli = startCLI([script]);
14+
15+
function onFatal(error) {
16+
cli.quit();
17+
throw error;
18+
}
19+
20+
cli.waitForInitialBreak()
21+
.then(() => cli.waitForPrompt())
22+
.then(() => cli.command('setBreakpoint(1)'))
23+
.then(() => cli.command('restart'))
24+
.then(() => cli.waitForInitialBreak())
25+
.then(() => cli.waitForPrompt())
26+
.then(() => cli.command('setBreakpoint(1)'))
27+
.then(() => cli.command('restart'))
28+
.then(() => cli.waitFor(/Breakpoint at specified location already exists/))
29+
.then(() => cli.quit())
30+
.then(null, onFatal);
31+
}

0 commit comments

Comments
 (0)