File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ class ConventionalChangelog extends Plugin {
48
48
async function getWhatBump ( ) {
49
49
if ( options . whatBump === false ) {
50
50
return ( ) => ( { releaseType : null } ) ;
51
+ } else if ( typeof options . whatBump === 'function' ) {
52
+ return options . whatBump ;
51
53
}
52
54
const bumperPreset = await bumper . preset ;
53
55
Original file line number Diff line number Diff line change 1
- import test from 'node:test' ;
1
+ import { mock , test } from 'node:test' ;
2
2
import { strict as assert } from 'assert' ;
3
3
import fs from 'fs' ;
4
4
import path from 'path' ;
@@ -382,6 +382,21 @@ test('should not bump when whatBump === false', async () => {
382
382
}
383
383
} ) ;
384
384
385
+ test ( 'should use given whatBump when provided' , async ( ) => {
386
+ setup ( ) ;
387
+ sh . exec ( `git tag 1.0.0` ) ;
388
+ add ( 'fix' , 'bar' ) ;
389
+ const whatBump = mock . fn ( )
390
+ {
391
+ const options = getOptions ( { whatBump } ) ;
392
+ await runTasks ( ...options ) ;
393
+ assert . ok ( whatBump . mock . callCount ( ) > 1 )
394
+ const commitHeaders = whatBump . mock . calls [ 0 ] . arguments [ 0 ] ?. map ( ( commit ) => commit . header )
395
+ assert . strictEqual ( commitHeaders . length , 1 )
396
+ assert . match ( commitHeaders [ 0 ] , / ^ f i x \( b a r \) : / )
397
+ }
398
+ } ) ;
399
+
385
400
// TODO Prepare test and verify results influenced by parserOpts and writerOpts
386
401
test . skip ( 'should pass parserOpts and writerOpts' , async t => {
387
402
setup ( ) ;
You can’t perform that action at this time.
0 commit comments