diff --git a/lib/_debug_agent.js b/lib/_debug_agent.js index 63c5035789..152a7c65a6 100644 --- a/lib/_debug_agent.js +++ b/lib/_debug_agent.js @@ -48,6 +48,7 @@ function Agent() { this.first = true; this.binding = process._debugAPI; + assert(this.binding, 'Debugger agent running without bindings!'); var self = this; this.binding.onmessage = function(msg) { @@ -57,7 +58,6 @@ function Agent() { }; this.clients = []; - assert(this.binding, 'Debugger agent running without bindings!'); } util.inherits(Agent, net.Server); diff --git a/test/parallel/test-debug-agent.js b/test/parallel/test-debug-agent.js new file mode 100644 index 0000000000..0bb5d7f9be --- /dev/null +++ b/test/parallel/test-debug-agent.js @@ -0,0 +1,6 @@ +'use strict'; +require('../common'); +const assert = require('assert'); + +assert.throws(() => { require('_debug_agent').start(); }, + assert.AssertionError);