Skip to content

Commit e69ec73

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 8ce21f1 commit e69ec73

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Diff for: test/sequential/test-debugger-breakpoint-exists.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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.waitFor(/listening/))
22+
.then(() => cli.waitFor(/attached/))
23+
.then(() => cli.waitFor(/Break on/))
24+
.then(() => cli.waitForPrompt())
25+
.then(() => cli.command('setBreakpoint(1)'))
26+
.then(() => cli.command('restart'))
27+
.then(() => cli.waitFor(/listening/))
28+
.then(() => cli.waitFor(/attached/))
29+
.then(() => cli.waitFor(/Break on/))
30+
.then(() => cli.waitForPrompt())
31+
.then(() => cli.command('setBreakpoint(1)'))
32+
.then(() => cli.command('restart'))
33+
.then(() => cli.waitFor(/Breakpoint at specified location already exists/))
34+
.then(() => cli.quit())
35+
.then(null, onFatal);
36+
}

0 commit comments

Comments
 (0)