GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: add `Debugger.setInstrumentationBreakpoint` known issue · nodejs/node@e016e95

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test
    • common
      • index.js
    • fixtures/inspector-instrumentation-breakpoint
      • dep.js
      • main.js
    • known_issues
      • test-inspector-instrumentation-breakpoint.js
Expand file treeCollapse file tree
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

‎test/fixtures/inspector-instrumentation-breakpoint/dep.js‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('dep loaded');
Collapse file

‎test/fixtures/inspector-instrumentation-breakpoint/main.js‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('./dep');
Collapse file

‎test/known_issues/test-inspector-instrumentation-breakpoint.js‎

Copy file name to clipboard
+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)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.