@@ -86,6 +86,30 @@ describe('config files', function () {
86
86
expect ( content ) . toContain ( issueUrlFormat ) ;
87
87
} ) ;
88
88
89
+ it ( 'reads config from custom path' , async function ( ) {
90
+ const issueUrlFormat = 'http://www.foo.com/{{id}}' ;
91
+ const changelog = ( { preset } ) => preset . issueUrlFormat ;
92
+ mock ( { bump : 'minor' , changelog } ) ;
93
+ fs . mkdirSync ( 'custom-folder' ) ;
94
+ fs . writeFileSync (
95
+ 'custom-folder/.versionrc.json' ,
96
+ JSON . stringify ( { issueUrlFormat } ) ,
97
+ 'utf-8' ,
98
+ ) ;
99
+
100
+ // Override process.argv to simulate CLI arguments before `exec`.
101
+ // This ensures yargs parses the custom config argument.
102
+ const originalArgv = process . argv ;
103
+ process . argv = [ 'node' , 'script.js' , '-c' , 'custom-folder/.versionrc.json' ] ;
104
+
105
+ await exec ( [ '-c' , 'custom-folder/.versionrc.json' ] ) ;
106
+ const content = fs . readFileSync ( 'CHANGELOG.md' , 'utf-8' ) ;
107
+ expect ( content ) . toContain ( issueUrlFormat ) ;
108
+
109
+ // Restore original process.argv
110
+ process . argv = originalArgv ;
111
+ } ) ;
112
+
89
113
it ( 'evaluates a config-function from .versionrc.js' , async function ( ) {
90
114
const issueUrlFormat = 'http://www.foo.com/{{id}}' ;
91
115
const src = `module.exports = function() { return ${ JSON . stringify ( {
0 commit comments