feat: allow to define plugin options globally

This commit is contained in:
Pierre Vanduynslager
2017-12-22 14:22:30 -05:00
parent d28b7e3e07
commit f707b1a90a
6 changed files with 64 additions and 35 deletions
+15
View File
@@ -48,6 +48,21 @@ test('Use default when only options are passed for a single plugin', t => {
t.is(typeof plugins.analyzeCommits, 'function');
});
test('Merge global options with plugin options', async t => {
const plugins = getPlugins(
{
globalOpt: 'global',
otherOpt: 'globally-defined',
getLastRelease: {path: './test/fixtures/plugin-result-config', localOpt: 'local', otherOpt: 'locally-defined'},
},
t.context.logger
);
const result = await plugins.getLastRelease();
t.deepEqual(result.pluginConfig, {localOpt: 'local', globalOpt: 'global', otherOpt: 'locally-defined'});
});
test('Throw an error if plugin configuration is missing a path for plugin pipeline', t => {
const error = t.throws(() => getPlugins({verifyConditions: {}}, t.context.logger), Error);