-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inspector: --debug* deprecation and invalidation
PR-URL: #12949 Fixes: #12364 Fixes: #12630 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jan Krems <[email protected]>
- Loading branch information
Showing
10 changed files
with
180 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
common.skipIfInspectorDisabled(); | ||
const assert = require('assert'); | ||
const helper = require('./inspector-helper.js'); | ||
|
||
function setupExpectBreakOnLine(line, url, session, scopeIdCallback) { | ||
return function(message) { | ||
if ('Debugger.paused' === message['method']) { | ||
const callFrame = message['params']['callFrames'][0]; | ||
const location = callFrame['location']; | ||
assert.strictEqual(url, session.scriptUrlForId(location['scriptId'])); | ||
assert.strictEqual(line, location['lineNumber']); | ||
scopeIdCallback && | ||
scopeIdCallback(callFrame['scopeChain'][0]['object']['objectId']); | ||
return true; | ||
} | ||
}; | ||
} | ||
|
||
function testBreakpointOnStart(session) { | ||
const commands = [ | ||
{ 'method': 'Runtime.enable' }, | ||
{ 'method': 'Debugger.enable' }, | ||
{ 'method': 'Debugger.setPauseOnExceptions', | ||
'params': {'state': 'none'} }, | ||
{ 'method': 'Debugger.setAsyncCallStackDepth', | ||
'params': {'maxDepth': 0} }, | ||
{ 'method': 'Profiler.enable' }, | ||
{ 'method': 'Profiler.setSamplingInterval', | ||
'params': {'interval': 100} }, | ||
{ 'method': 'Debugger.setBlackboxPatterns', | ||
'params': {'patterns': []} }, | ||
{ 'method': 'Runtime.runIfWaitingForDebugger' } | ||
]; | ||
|
||
session | ||
.sendInspectorCommands(commands) | ||
.expectMessages(setupExpectBreakOnLine(0, session.mainScriptPath, session)); | ||
} | ||
|
||
function testWaitsForFrontendDisconnect(session, harness) { | ||
console.log('[test]', 'Verify node waits for the frontend to disconnect'); | ||
session.sendInspectorCommands({ 'method': 'Debugger.resume'}) | ||
.expectStderrOutput('Waiting for the debugger to disconnect...') | ||
.disconnect(true); | ||
} | ||
|
||
function runTests(harness) { | ||
harness | ||
.runFrontendSession([ | ||
testBreakpointOnStart, | ||
testWaitsForFrontendDisconnect | ||
]).expectShutDown(55); | ||
} | ||
|
||
helper.startNodeForInspectorTest(runTests, ['--inspect', '--debug-brk']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
const assert = require('assert'); | ||
const execFile = require('child_process').execFile; | ||
const path = require('path'); | ||
|
||
const common = require('../common'); | ||
common.skipIfInspectorDisabled(); | ||
|
||
const mainScript = path.join(common.fixturesDir, 'loop.js'); | ||
const expected = | ||
'`node --debug` and `node --debug-brk` are invalid. ' + | ||
'Please use `node --inspect` or `node --inspect-brk` instead.'; | ||
for (const invalidArg of ['--debug-brk', '--debug']) { | ||
execFile( | ||
process.execPath, | ||
[ invalidArg, mainScript ], | ||
common.mustCall((error, stdout, stderr) => { | ||
assert.strictEqual(error.code, 9, `node ${invalidArg} should exit 9`); | ||
assert.strictEqual(stderr.includes(expected), true, | ||
`${stderr} should include '${expected}'`); | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
common.skipIfInspectorDisabled(); | ||
const assert = require('assert'); | ||
const spawn = require('child_process').spawn; | ||
|
||
const script = common.fixturesDir + '/empty.js'; | ||
|
||
function test(arg) { | ||
const child = spawn(process.execPath, ['--inspect', arg, script]); | ||
const argStr = child.spawnargs.join(' '); | ||
const fail = () => assert.fail(true, false, `'${argStr}' should not quit`); | ||
child.on('exit', fail); | ||
|
||
// give node time to start up the debugger | ||
setTimeout(function() { | ||
child.removeListener('exit', fail); | ||
child.kill(); | ||
}, 2000); | ||
|
||
process.on('exit', function() { | ||
assert(child.killed); | ||
}); | ||
} | ||
|
||
test('--debug-brk'); | ||
test('--debug-brk=5959'); |