diff --git a/src/agent/debuglet.js b/src/agent/debuglet.js index 5b19e5d7..86b768e8 100644 --- a/src/agent/debuglet.js +++ b/src/agent/debuglet.js @@ -96,7 +96,7 @@ module.exports = Debuglet; */ function Debuglet(debug, config) { /** @private {object} */ - this.config_ = this.normalizeConfig_(config); + this.config_ = Debuglet.normalizeConfig_(config); /** @private {Debug} */ this.debug_ = debug; @@ -139,7 +139,7 @@ function Debuglet(debug, config) { util.inherits(Debuglet, EventEmitter); -Debuglet.prototype.normalizeConfig_ = function(config) { +Debuglet.normalizeConfig_ = function(config) { var envConfig = { logLevel: process.env.GCLOUD_DEBUG_LOGLEVEL, serviceContext: { diff --git a/test/test-debuglet.js b/test/test-debuglet.js index 9e328ad3..d9bc26e3 100644 --- a/test/test-debuglet.js +++ b/test/test-debuglet.js @@ -59,17 +59,15 @@ describe('Debuglet', function() { afterEach(function() { nock.cleanAll(); }); it('should merge config correctly', function() { - var debug = require('../src/debug.js')(); - var testValue = 2 * defaultConfig.capture.maxExpandFrames; var config = {capture: {maxExpandFrames: testValue}}; - var debuglet = new Debuglet(debug, config); + var mergedConfig = Debuglet.normalizeConfig_(config); + var compareConfig = Debuglet.normalizeConfig_(); // The actual config should be exactly defaultConfig with only // maxExpandFrames adjusted. - var compareConfig = extend(true, {}, defaultConfig); compareConfig.capture.maxExpandFrames = testValue; - assert.deepEqual(debuglet.config_, compareConfig); + assert.deepEqual(mergedConfig, compareConfig); }); it('should not start when projectId is not available', function(done) {