Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e016e95

Browse filesBrowse files
ulitinktargos
authored andcommitted
test: add Debugger.setInstrumentationBreakpoint known issue
PR-URL: #31137 Refs: #31138 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 944ae59 commit e016e95
Copy full SHA for e016e95

File tree

Expand file treeCollapse file tree

4 files changed

+58
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+58
-1
lines changed
Open diff view settings
Collapse file

‎test/common/index.js‎

Copy file name to clipboardExpand all lines: test/common/index.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,8 @@ function printSkipMessage(msg) {
603603

604604
function skip(msg) {
605605
printSkipMessage(msg);
606-
process.exit(0);
606+
// In known_issues test, skipping should produce a non-zero exit code.
607+
process.exit(require.main?.filename.startsWith(path.resolve(__dirname, '../known_issues/')) ? 1 : 0);
607608
}
608609

609610
// Returns true if the exit code "exitCode" and/or signal name "signal"
Collapse file
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('dep loaded');
Collapse file
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('./dep');
Collapse file
+54Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// This test validates inspector's Debugger.setInstrumentationBreakpoint method.
2+
// Refs: https://github.com/nodejs/node/issues/31138
3+
4+
'use strict';
5+
const common = require('../common');
6+
7+
common.skipIfInspectorDisabled();
8+
9+
const assert = require('assert');
10+
const { resolve: UrlResolve } = require('url');
11+
const fixtures = require('../common/fixtures');
12+
const { NodeInstance } = require('../common/inspector-helper.js');
13+
14+
async function testBreakpointBeforeScriptExecution(session) {
15+
console.log('[test]',
16+
'Verifying debugger stops on start of each script ' +
17+
'(Debugger.setInstrumentationBreakpoint with beforeScriptExecution)');
18+
const commands = [
19+
{ 'method': 'Runtime.enable' },
20+
{ 'method': 'Debugger.enable' },
21+
{ 'method': 'Debugger.setInstrumentationBreakpoint',
22+
'params': { 'instrumentation': 'beforeScriptExecution' } },
23+
{ 'method': 'Runtime.runIfWaitingForDebugger' },
24+
];
25+
26+
await session.send(commands);
27+
28+
// Break on start
29+
await session.waitForBreakOnLine(
30+
0, UrlResolve(session.scriptURL().toString(), 'main.js'));
31+
await session.send([{ 'method': 'Debugger.resume' }]);
32+
33+
// Script loaded
34+
await session.waitForBreakOnLine(
35+
0, UrlResolve(session.scriptURL().toString(), 'main.js'));
36+
await session.send([{ 'method': 'Debugger.resume' }]);
37+
38+
// Script loaded
39+
await session.waitForBreakOnLine(
40+
0, UrlResolve(session.scriptURL().toString(), 'dep.js'));
41+
await session.send([{ 'method': 'Debugger.resume' }]);
42+
}
43+
44+
async function runTest() {
45+
const main = fixtures.path('inspector-instrumentation-breakpoint', 'main.js');
46+
const child = new NodeInstance(['--inspect-brk=0'], '', main);
47+
48+
const session = await child.connectInspectorSession();
49+
await testBreakpointBeforeScriptExecution(session);
50+
await session.runToCompletion();
51+
assert.strictEqual((await child.expectShutdown()).exitCode, 0);
52+
}
53+
54+
runTest();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.