fix: set default path to generateNotes object config
				
					
				
			This commit is contained in:
		
							parent
							
								
									24ce560065
								
							
						
					
					
						commit
						d8e59cce53
					
				| @ -17,9 +17,10 @@ module.exports = (options, pluginsPath, logger) => { | ||||
|       if (isUndefined(options[type])) { | ||||
|         pluginConfs = def; | ||||
|       } else { | ||||
|         const defaultPaths = castArray(def); | ||||
|         // If an object is passed and the path is missing, set the default one for single plugins
 | ||||
|         if (isPlainObject(options[type]) && !options[type].path && castArray(def).length === 1) { | ||||
|           options[type].path = def; | ||||
|         if (isPlainObject(options[type]) && !options[type].path && defaultPaths.length === 1) { | ||||
|           [options[type].path] = defaultPaths; | ||||
|         } | ||||
|         if (configValidator && !configValidator(options[type])) { | ||||
|           errors.push(getError('EPLUGINCONF', {type, pluginConf: options[type]})); | ||||
|  | ||||
| @ -117,13 +117,15 @@ test.serial('Export plugins loaded from the dependency of a shareable config fil | ||||
| 
 | ||||
| test('Use default when only options are passed for a single plugin', t => { | ||||
|   const analyzeCommits = {}; | ||||
|   const generateNotes = {}; | ||||
|   const success = () => {}; | ||||
|   const fail = [() => {}]; | ||||
| 
 | ||||
|   const plugins = getPlugins({analyzeCommits, success, fail}, {}, t.context.logger); | ||||
|   const plugins = getPlugins({analyzeCommits, generateNotes, success, fail}, {}, t.context.logger); | ||||
| 
 | ||||
|   // Verify the module returns a function for each plugin
 | ||||
|   t.is(typeof plugins.analyzeCommits, 'function'); | ||||
|   t.is(typeof plugins.generateNotes, 'function'); | ||||
|   t.is(typeof plugins.success, 'function'); | ||||
|   t.is(typeof plugins.fail, 'function'); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user