Skip to content

Commit

Permalink
fix(config): not append empty module if no custom launcher/rep/prep
Browse files Browse the repository at this point in the history
Just to get rid off the confusing debug message:
"DEBUG [plugin]: Loading inlined plugin (defining )."
  • Loading branch information
vojtajina committed Nov 16, 2013
1 parent d90809a commit ee15a4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ var normalizeConfig = function(config, configFilePath) {

// define custom launchers/preprocessors/reporters - create an inlined plugin
var module = Object.create(null);
var hasSomeInlinedPlugin = false;
['launcher', 'preprocessor', 'reporter'].forEach(function(type) {
var definitions = config['custom' + helper.ucFirst(type) + 's'] || {};

Expand All @@ -152,10 +153,13 @@ var normalizeConfig = function(config, configFilePath) {
module[type + ':' + name] = ['factory', function(injector) {
return injector.createChild([locals], [token]).get(token);
}];
hasSomeInlinedPlugin = true;
});
});

config.plugins.push(module);
if (hasSomeInlinedPlugin) {
config.plugins.push(module);
}

return config;
};
Expand Down
5 changes: 5 additions & 0 deletions test/unit/config.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,8 @@ describe 'config', ->
expect(injectedArgs).to.be.defined
expect(injectedArgs.third).to.equal 123
expect(injectedArgs.whatever).to.equal 'ccc'


it 'should not create empty module', ->
config = normalizeConfigWithDefaults {}
expect(config.plugins).to.deep.equal []

0 comments on commit ee15a4e

Please sign in to comment.