Skip to content

Commit

Permalink
fix: use whatBump opt when provided
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 committed Nov 9, 2024
1 parent f07f530 commit 13ed283
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class ConventionalChangelog extends Plugin {
async function getWhatBump() {
if (options.whatBump === false) {
return () => ({ releaseType: null });
} else if (typeof options.whatBump === 'function') {
return options.whatBump;
}
const bumperPreset = await bumper.preset;

Expand Down
12 changes: 11 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import test from 'node:test';
import {mock, test} from 'node:test';
import { strict as assert } from 'assert';
import fs from 'fs';
import path from 'path';
Expand Down Expand Up @@ -382,6 +382,16 @@ test('should not bump when whatBump === false', async () => {
}
});

test('should use given whatBump when provided', async () => {
setup();
const whatBump = mock.fn()
{
const options = getOptions({ whatBump });
await runTasks(...options);
assert.ok(whatBump.mock.callCount() > 1)
}
});

// TODO Prepare test and verify results influenced by parserOpts and writerOpts
test.skip('should pass parserOpts and writerOpts', async t => {
setup();
Expand Down

0 comments on commit 13ed283

Please sign in to comment.