fix: log plugin type in addition of path

This commit is contained in:
Pierre Vanduynslager 2017-12-10 03:56:30 -05:00
parent 88f33ec482
commit 4053d8f7fb
2 changed files with 6 additions and 6 deletions

View File

@ -8,7 +8,7 @@ module.exports = (pluginType, pluginConfig, logger, validator) => {
}
const {path, ...config} = isString(pluginConfig) || isFunction(pluginConfig) ? {path: pluginConfig} : pluginConfig;
if (!isFunction(pluginConfig)) {
logger.log('Load plugin %s', path);
logger.log('Load plugin %s from %s', pluginType, path);
}
const plugin = isFunction(path) ? path : importFrom.silent(__dirname, path) || importFrom(process.cwd(), path);

View File

@ -10,17 +10,17 @@ test.beforeEach(t => {
});
test('Normalize and load plugin from string', t => {
const plugin = normalize('', './test/fixtures/plugin-noop', t.context.logger);
const plugin = normalize('verifyConditions', './test/fixtures/plugin-noop', t.context.logger);
t.is(typeof plugin, 'function');
t.true(t.context.log.calledWith(match.string, './test/fixtures/plugin-noop'));
t.true(t.context.log.calledWith(match.string, 'verifyConditions', './test/fixtures/plugin-noop'));
});
test('Normalize and load plugin from object', t => {
const plugin = normalize('', {path: './test/fixtures/plugin-noop'}, t.context.logger);
const plugin = normalize('publish', {path: './test/fixtures/plugin-noop'}, t.context.logger);
t.is(typeof plugin, 'function');
t.true(t.context.log.calledWith(match.string, './test/fixtures/plugin-noop'));
t.true(t.context.log.calledWith(match.string, 'publish', './test/fixtures/plugin-noop'));
});
test('Normalize and load plugin from function', t => {
@ -33,7 +33,7 @@ test('Normalize and load plugin that retuns multiple functions', t => {
const plugin = normalize('verifyConditions', './test/fixtures/multi-plugin', t.context.logger);
t.is(typeof plugin, 'function');
t.true(t.context.log.calledWith(match.string, './test/fixtures/multi-plugin'));
t.true(t.context.log.calledWith(match.string, 'verifyConditions', './test/fixtures/multi-plugin'));
});
test('Wrap plugin in a function that validate the output of the plugin', async t => {