Skip to content

Commit

Permalink
fix(module): warn if default strategy is not valid (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
motia authored and pi0 committed May 31, 2019
1 parent c02ca45 commit db6d3d4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/module/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ module.exports = function (moduleOptions) {
delete options.strategies

// Set defaultStrategy
if (!options.defaultStrategy && strategies.length) {
options.defaultStrategy = strategies[0]._name
} else {
const strategyNames = strategies.map(x => x._name)
options.defaultStrategy = options.defaultStrategy || strategyNames[0]

if (!options.defaultStrategy) {
logger.warn('no strategy defined!')
} else if(strategyNames.indexOf(options.defaultStrategy) === -1) {
logger.warn(`strategy ${options.defaultStrategy} is not defined!`)
}

// Copy plugin
Expand Down

0 comments on commit db6d3d4

Please sign in to comment.