| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 944ae59 commit e016e95
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -603,7 +603,8 @@ function printSkipMessage(msg) { | |||
| 603 | 603 | ||
| 604 | 604 | function skip(msg) { | |
| 605 | 605 | 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); | ||
| 607 | 608 | } | |
| 608 | 609 | ||
| 609 | 610 | // Returns true if the exit code "exitCode" and/or signal name "signal" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + console.log('dep loaded'); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + require('./dep'); | ||
| Original file line number | Diff line number | Diff 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(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments