Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: ensure error function call on inspector disabled
If the process.config.variables.v8_enable_inspector
is undefined or set to 0 and the sendInspectorCommand
function is called, it should call the error function
and should NOT call the callback function.
  • Loading branch information
madeinjam committed Oct 13, 2018
commit 2431bca5572110e2e2a3bd2240b7d6f6cd80365a
20 changes: 20 additions & 0 deletions test/sequential/test-inspector-has-inspector-false.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Flags: --expose-internals
'use strict';

const common = require('../common');

// This is to ensure that the sendInspectorCommand function calls the error
// function if its called with the v8_enable_inspector is disabled

const v8EnableInspectorBk = process.config.variables.v8_enable_inspector;
process.config.variables.v8_enable_inspector = 0;
const inspector = require('internal/util/inspector');

function restoreProcessVar() {
process.config.variables.v8_enable_inspector = v8EnableInspectorBk;
}

inspector.sendInspectorCommand(
common.mustNotCall('Inspector callback should not be called'),
common.mustCall(restoreProcessVar, 1),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @madeinjam! Welcome and thanks for the pull request! I believe restoreProcessVar() can be removed from the file. The process exits, so there's no need to reset the value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Trott ! I made the change, thank you!

);