diff --git a/test/sequential/test-inspector-send-inspector-command-exception.js b/test/sequential/test-inspector-send-inspector-command-exception.js new file mode 100644 index 00000000000000..3b512cdddec4e4 --- /dev/null +++ b/test/sequential/test-inspector-send-inspector-command-exception.js @@ -0,0 +1,16 @@ +// Flags: --expose-internals +'use strict'; + +const common = require('../common'); + +// This is to ensure that the sendInspectorCommand function calls the cb +// function if v8_enable_inspector is enabled +process.config.variables.v8_enable_inspector = 1; +const inspector = require('internal/util/inspector'); + +// Pass first argument as a function that throws an error that will be caught +// and onError() will be called +inspector.sendInspectorCommand( + common.mustCall(() => { throw new Error('foo'); }), + common.mustCall() +);