Skip to content

Supplied configuration is overridden in the TestUtility.injectCore #56

Description

@gconsidine

When supplying configuration in a test using injectCore, the configuration is overridden by the default configuration included in BlueOak Server, for example:

var testUtility = require('blueoak-server').testUtility();
var coreServices = ['config', 'logger'];

var testSpecificConfig = {
  app: {
    key: 'value'
  }
};

testUtility.injectCore(coreServices, testSpecifcConfig, function (initializedModules) {
  var config = initializedModules.config;
  var logger = intializedModules.logger;

  var appConfig = config.get('app');

  // appConfig is {} instead of { key: 'value' }
});

Files that would possibly be affected by a fix for this:

https://github.com/BlueOakJS/blueoak-server/blob/master/testlib/util.js#L92
https://github.com/BlueOakJS/blueoak-server/blob/master/services/config.js#L18

In config.js, the fs.readFile block overrides any config passed into injectCore

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions