0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/sequential/test-inspector-overwrite-config.js
Joyee Cheung 8484b40b3d
src: put bootstrappers in lib/internal/bootstrap/
Create `lib/internal/bootstrap/` and put bootstrappers there:

Before:

```
lib/internal
├── ...
├── bootstrap_loaders.js
└── bootstrap_node.js
```

After:

```
lib/internal
├── ...
└── bootstrap
    ├── loaders.js
    └── node.js
```

PR-URL: https://github.com/nodejs/node/pull/19177
Refs: https://github.com/nodejs/node/pull/19112
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2018-03-15 20:50:34 +08:00

43 lines
1.3 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');
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();
}
common.crashOnUnhandledRejection();
async function runTests() {
await testConsoleLog();
assert.ok(asserted, 'log statement did not reach the inspector');
}
runTests();