Skip to content

Commit

Permalink
instrumentation: check for null module in inspector instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Clement committed Jun 20, 2017
1 parent 47d4c46 commit 2eb9516
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/instrumentation/core/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var wrap = require('../../shimmer').wrapMethod
module.exports = initialize

function initialize(agent, inspector) {
var sessionProto = inspector.Session && inspector.Session.prototype
var sessionProto = inspector && inspector.Session && inspector.Session.prototype
if (!sessionProto) {
return false
}
Expand Down
22 changes: 22 additions & 0 deletions test/unit/instrumentation/core/inspector.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict'

var chai = require('chai')
var helper = require('../../../lib/agent_helper')
var inspectorInstrumentation = require('../../../../lib/instrumentation/core/inspector')

var expect = chai.expect

describe('Inspector instrumentation', function() {
var agent = null
before(function() {
agent = helper.loadMockedAgent()
})

after(function () {
helper.unloadAgent(agent)
})

it('should not throw when passed null for the module', function() {
expect(inspectorInstrumentation.bind(null, agent, null)).to.not.throw()
})
})

0 comments on commit 2eb9516

Please sign in to comment.