File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
packages/shipjs/src/step/prepare Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ const fs = require ( 'fs' ) ;
2+ import prepareParams from '../updateChangelog' ;
3+ import tempWrite from 'temp-write' ;
4+
5+ describe ( 'prepareParams' , ( ) => {
6+ it ( 'loads configuration from --config option' , ( ) => {
7+ const config = {
8+ writerOpts : {
9+ headerPartial : '## {{version}}' ,
10+ } ,
11+ } ;
12+ const configString = `module.exports = { ${ config } };` ;
13+ const configPath = tempWrite . sync ( configString ) ;
14+ const configDir = path . basename ( path . dirname ( configPath ) ) ;
15+
16+ const { args } = prepareParams ( {
17+ dir : configDir ,
18+ conventionalChangelogArgs : `--config ${ configPath } ` ,
19+ revisionRange : '1.0.0..1.0.1' ,
20+ reject : ( ) => { } ,
21+ } ) ;
22+ expect ( args . config ) . toMatch ( config ) ;
23+ } ) ;
24+ } ) ;
Original file line number Diff line number Diff line change @@ -118,6 +118,9 @@ function prepareParams({
118118 }
119119 const templateContext =
120120 args . context && require ( path . resolve ( dir , args . context ) ) ;
121+ if ( args . config ) {
122+ args . config = require ( path . resolve ( dir , args . config ) ) ;
123+ }
121124 return { args, gitRawCommitsOpts, templateContext } ;
122125}
123126
You can’t perform that action at this time.
0 commit comments