diff --git a/index.js b/index.js index 3d452df8d5..e148c98dfe 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,3 @@ -const process = require('process'); const {template, pick} = require('lodash'); const marked = require('marked'); const TerminalRenderer = require('marked-terminal'); diff --git a/lib/plugins/normalize.js b/lib/plugins/normalize.js index 15ff4ce2e8..45b7be2ae7 100644 --- a/lib/plugins/normalize.js +++ b/lib/plugins/normalize.js @@ -1,11 +1,11 @@ const {dirname} = require('path'); -const {isString, isPlainObject, isFunction, noop, cloneDeep} = require('lodash'); +const {isString, isPlainObject, isFunction, noop, cloneDeep, omit} = require('lodash'); const resolveFrom = require('resolve-from'); const getError = require('../get-error'); const {extractErrors} = require('../utils'); const PLUGINS_DEFINITIONS = require('../definitions/plugins'); -module.exports = ({cwd, options, logger}, type, pluginOpt, pluginsPath) => { +module.exports = ({cwd, stdout, stderr, options, logger}, type, pluginOpt, pluginsPath) => { if (!pluginOpt) { return noop; } @@ -31,7 +31,12 @@ module.exports = ({cwd, options, logger}, type, pluginOpt, pluginsPath) => { const {outputValidator} = PLUGINS_DEFINITIONS[type] || {}; try { logger.log(`Start step "${type}" of plugin "${pluginName}"`); - const result = await func({...cloneDeep(input), logger: logger.scope(logger.scopeName, pluginName)}); + const result = await func({ + ...cloneDeep(omit(input, ['stdout', 'stderr', 'logger'])), + stdout, + stderr, + logger: logger.scope(logger.scopeName, pluginName), + }); if (outputValidator && !outputValidator(result)) { throw getError(`E${type.toUpperCase()}OUTPUT`, {result, pluginName}); } diff --git a/test/plugins/normalize.test.js b/test/plugins/normalize.test.js index 4d9bc13b6e..fbf045a6da 100644 --- a/test/plugins/normalize.test.js +++ b/test/plugins/normalize.test.js @@ -160,7 +160,10 @@ test('Plugin is called with "pluginConfig" (omitting "path", adding global confi await plugin({param: 'param'}); t.true( - pluginFunction.calledWith({conf: 'confValue', global: 'globalValue'}, {param: 'param', logger: t.context.logger}) + pluginFunction.calledWithMatch( + {conf: 'confValue', global: 'globalValue'}, + {param: 'param', logger: t.context.logger} + ) ); });