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 lib/internal/bootstrap/node.js. 6// Specifically this tests 7// that the inspector console functions are bound even though 8// overwrite-config-preload-module.js overwrote the process.config variable. 9 10// We cannot do a check for the inspector because the configuration variables 11// were reset/removed by overwrite-config-preload-module.js. 12/* eslint-disable node-core/inspector-check */ 13 14const common = require('../common'); 15const assert = require('assert'); 16 17if (!common.isMainThread) 18 common.skip('--require does not work with Workers'); 19 20const inspector = require('inspector'); 21const msg = 'Test inspector logging'; 22let asserted = false; 23 24async function testConsoleLog() { 25 const session = new inspector.Session(); 26 session.connect(); 27 session.on('inspectorNotification', (data) => { 28 if (data.method === 'Runtime.consoleAPICalled') { 29 assert.strictEqual(data.params.args.length, 1); 30 assert.strictEqual(data.params.args[0].value, msg); 31 asserted = true; 32 } 33 }); 34 session.post('Runtime.enable'); 35 console.log(msg); 36 session.disconnect(); 37} 38 39async function runTests() { 40 await testConsoleLog(); 41 assert.ok(asserted, 'log statement did not reach the inspector'); 42} 43 44runTests().then(common.mustCall()); 45