Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d437025

Browse filesBrowse files
MoLowruyadorno
authored andcommitted
inspector: allow opening inspector when NODE_V8_COVERAGE is set
PR-URL: #46113 Fixes: #46110 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 232bdd5 commit d437025
Copy full SHA for d437025

File tree

Expand file treeCollapse file tree

3 files changed

+36
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+36
-1
lines changed
Open diff view settings
Collapse file

‎src/inspector_js_api.cc‎

Copy file name to clipboardExpand all lines: src/inspector_js_api.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static void RegisterAsyncHookWrapper(const FunctionCallbackInfo<Value>& args) {
273273

274274
void IsEnabled(const FunctionCallbackInfo<Value>& args) {
275275
Environment* env = Environment::GetCurrent(args);
276-
args.GetReturnValue().Set(InspectorEnabled(env));
276+
args.GetReturnValue().Set(env->inspector_agent()->IsListening());
277277
}
278278

279279
void Open(const FunctionCallbackInfo<Value>& args) {
Collapse file

‎test/fixtures/inspector-open.js‎

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const assert = require('assert');
2+
const inspector = require('inspector');
3+
4+
5+
assert.strictEqual(inspector.url(), undefined);
6+
inspector.open(0, undefined, false);
7+
assert(inspector.url().startsWith('ws://'));
8+
assert.throws(() => {
9+
inspector.open(0, undefined, false);
10+
}, {
11+
code: 'ERR_INSPECTOR_ALREADY_ACTIVATED'
12+
});
13+
inspector.close();
14+
assert.strictEqual(inspector.url(), undefined);
Collapse file
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const { spawnSync } = require('child_process');
6+
const fixtures = require('../common/fixtures');
7+
const tmpdir = require('../common/tmpdir');
8+
9+
common.skipIfInspectorDisabled();
10+
common.skipIfWorker();
11+
12+
tmpdir.refresh();
13+
14+
15+
let output = spawnSync(process.execPath, [fixtures.path('inspector-open.js')]);
16+
assert.strictEqual(output.status, 0);
17+
18+
output = spawnSync(process.execPath, [fixtures.path('inspector-open.js')], {
19+
env: { ...process.env, NODE_V8_COVERAGE: tmpdir.path },
20+
});
21+
assert.strictEqual(output.status, 0);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.