| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7ba3599 commit 6c0fd55
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -327,10 +327,10 @@ | |||
| 327 | 327 | } | |
| 328 | 328 | ||
| 329 | 329 | function setupInspector(originalConsole, wrappedConsole, Module) { | |
| 330 | - const { addCommandLineAPI, consoleCall } = process.binding('inspector'); | ||
| 331 | - if (!consoleCall) { | ||
| 330 | + if (!process.config.variables.v8_enable_inspector) { | ||
| 332 | 331 | return; | |
| 333 | 332 | } | |
| 333 | + const { addCommandLineAPI, consoleCall } = process.binding('inspector'); | ||
| 334 | 334 | // Setup inspector command line API | |
| 335 | 335 | const { makeRequireFunction } = NativeModule.require('internal/module'); | |
| 336 | 336 | const path = NativeModule.require('path'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + 'use strict' | ||
| 2 | + const common = require('../common'); | ||
| 3 | + common.skipIfInspectorDisabled(); | ||
| 4 | + | ||
| 5 | + process.config = {}; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,41 @@ | |||
| 1 | + // Flags: --require ./test/fixtures/overwrite-config-preload-module.js | ||
| 2 | + 'use strict'; | ||
| 3 | + | ||
| 4 | + // This test ensures that overwriting a process configuration | ||
| 5 | + // value does not affect code in bootstrap_node.js. Specifically this tests | ||
| 6 | + // that the inspector console functions are bound even though | ||
| 7 | + // overwrite-config-preload-module.js overwrote the process.config variable. | ||
| 8 | + | ||
| 9 | + // We cannot do a check for the inspector because the configuration variables | ||
| 10 | + // were reset/removed by overwrite-config-preload-module.js. | ||
| 11 | + /* eslint-disable inspector-check */ | ||
| 12 | + | ||
| 13 | + const common = require('../common'); | ||
| 14 | + const assert = require('assert'); | ||
| 15 | + const inspector = require('inspector'); | ||
| 16 | + const msg = 'Test inspector logging'; | ||
| 17 | + let asserted = false; | ||
| 18 | + | ||
| 19 | + async function testConsoleLog() { | ||
| 20 | + const session = new inspector.Session(); | ||
| 21 | + session.connect(); | ||
| 22 | + session.on('inspectorNotification', (data) => { | ||
| 23 | + if (data.method === 'Runtime.consoleAPICalled') { | ||
| 24 | + assert.strictEqual(data.params.args.length, 1); | ||
| 25 | + assert.strictEqual(data.params.args[0].value, msg); | ||
| 26 | + asserted = true; | ||
| 27 | + } | ||
| 28 | + }); | ||
| 29 | + session.post('Runtime.enable'); | ||
| 30 | + console.log(msg); | ||
| 31 | + session.disconnect(); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + common.crashOnUnhandledRejection(); | ||
| 35 | + | ||
| 36 | + async function runTests() { | ||
| 37 | + await testConsoleLog(); | ||
| 38 | + assert.ok(asserted, 'log statement did not reach the inspector'); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + runTests(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments