mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
7ece9f3c28
This moves sequential inspector tests that can be run in parallel (using random ports) to parallel. Before: ``` ❯ tools/test.py "test/sequential/test-inspector-*" [00:07|% 100|+ 28|- 0]: Done All tests passed. ❯ tools/test.py "test/parallel/test-inspector-*" [00:01|% 100|+ 26|- 0]: Done All tests passed. ``` After: ``` ❯ tools/test.py "test/sequential/test-inspector-*" [00:00|% 100|+ 1|- 0]: Done All tests passed. ❯ tools/test.py "test/parallel/test-inspector-*" [00:01|% 100|+ 53|- 0]: Done All tests passed. ``` PR-URL: https://github.com/nodejs/node/pull/47412 Refs: https://github.com/nodejs/node/issues/47146 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
// Flags: --require ./test/fixtures/overwrite-config-preload-module.js
|
|
'use strict';
|
|
|
|
// This test ensures that overwriting a process configuration
|
|
// value does not affect code in lib/internal/bootstrap/node.js.
|
|
// Specifically this tests
|
|
// that the inspector console functions are bound even though
|
|
// overwrite-config-preload-module.js overwrote the process.config variable.
|
|
|
|
// We cannot do a check for the inspector because the configuration variables
|
|
// were reset/removed by overwrite-config-preload-module.js.
|
|
/* eslint-disable node-core/inspector-check */
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
if (!common.isMainThread)
|
|
common.skip('--require does not work with Workers');
|
|
|
|
const inspector = require('inspector');
|
|
const msg = 'Test inspector logging';
|
|
let asserted = false;
|
|
|
|
async function testConsoleLog() {
|
|
const session = new inspector.Session();
|
|
session.connect();
|
|
session.on('inspectorNotification', (data) => {
|
|
if (data.method === 'Runtime.consoleAPICalled') {
|
|
assert.strictEqual(data.params.args.length, 1);
|
|
assert.strictEqual(data.params.args[0].value, msg);
|
|
asserted = true;
|
|
}
|
|
});
|
|
session.post('Runtime.enable');
|
|
console.log(msg);
|
|
session.disconnect();
|
|
}
|
|
|
|
async function runTests() {
|
|
await testConsoleLog();
|
|
assert.ok(asserted, 'log statement did not reach the inspector');
|
|
}
|
|
|
|
runTests().then(common.mustCall());
|