Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supplied configuration is overridden in the TestUtility.injectCore #56

Open
gconsidine opened this issue May 18, 2016 · 0 comments
Open

Comments

@gconsidine
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants