Skip to content

fix(bump): also propagate the parserOpts from args to conventionalRecommendedBump #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/lifecycles/bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function bumpVersion (releaseAs, currentVersion, args) {
path: args.path,
tagPrefix: args.tagPrefix,
lernaPackage: args.lernaPackage
}, function (err, release) {
}, args.parserOpts, function (err, release) {
if (err) return reject(err)
else return resolve(release)
})
Expand Down
6 changes: 3 additions & 3 deletions test/config-files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ function exec () {
*
* Mocks should be unregistered in test cleanup by calling unmock()
*
* bump?: 'major' | 'minor' | 'patch' | Error | (opt, cb) => { cb(err) | cb(null, { releaseType }) }
* bump?: 'major' | 'minor' | 'patch' | Error | (opt, parserOpts, cb) => { cb(err) | cb(null, { releaseType }) }
* changelog?: string | Error | Array<string | Error | (opt) => string | null>
* tags?: string[] | Error
*/
function mock ({ bump, changelog, tags } = {}) {
mockery.enable({ warnOnUnregistered: false, useCleanCache: true })

mockery.registerMock('conventional-recommended-bump', function (opt, cb) {
if (typeof bump === 'function') bump(opt, cb)
mockery.registerMock('conventional-recommended-bump', function (opt, parserOpts, cb) {
if (typeof bump === 'function') bump(opt, parserOpts, cb)
else if (bump instanceof Error) cb(bump)
else cb(null, bump ? { releaseType: bump } : {})
})
Expand Down
8 changes: 4 additions & 4 deletions test/core.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function getPackageVersion () {
*
* Mocks should be unregistered in test cleanup by calling unmock()
*
* bump?: 'major' | 'minor' | 'patch' | Error | (opt, cb) => { cb(err) | cb(null, { releaseType }) }
* bump?: 'major' | 'minor' | 'patch' | Error | (opt, parserOpts, cb) => { cb(err) | cb(null, { releaseType }) }
* changelog?: string | Error | Array<string | Error | (opt) => string | null>
* execFile?: ({ dryRun, silent }, cmd, cmdArgs) => Promise<string>
* fs?: { [string]: string | Buffer | any }
Expand All @@ -46,8 +46,8 @@ function getPackageVersion () {
function mock ({ bump, changelog, execFile, fs, pkg, tags } = {}) {
mockery.enable({ warnOnUnregistered: false, useCleanCache: true })

mockery.registerMock('conventional-recommended-bump', function (opt, cb) {
if (typeof bump === 'function') bump(opt, cb)
mockery.registerMock('conventional-recommended-bump', function (opt, parserOpts, cb) {
if (typeof bump === 'function') bump(opt, parserOpts, cb)
else if (bump instanceof Error) cb(bump)
else cb(null, bump ? { releaseType: bump } : {})
})
Expand Down Expand Up @@ -405,7 +405,7 @@ describe('cli', function () {

it('creates a prerelease with a new minor version after two prerelease patches', async function () {
let releaseType = 'patch'
const bump = (_, cb) => cb(null, { releaseType })
const bump = (_, __, cb) => cb(null, { releaseType })
mock({
bump,
fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
Expand Down
6 changes: 3 additions & 3 deletions test/git.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ function getPackageVersion () {
/**
* Mock external conventional-changelog modules
*
* bump: 'major' | 'minor' | 'patch' | Error | (opt, cb) => { cb(err) | cb(null, { releaseType }) }
* bump: 'major' | 'minor' | 'patch' | Error | (opt, parserOpts, cb) => { cb(err) | cb(null, { releaseType }) }
* changelog?: string | Error | Array<string | Error | (opt) => string | null>
* tags?: string[] | Error
*/
function mock ({ bump, changelog, tags }) {
if (bump === undefined) throw new Error('bump must be defined for mock()')
mockery.enable({ warnOnUnregistered: false, useCleanCache: true })

mockery.registerMock('conventional-recommended-bump', function (opt, cb) {
if (typeof bump === 'function') bump(opt, cb)
mockery.registerMock('conventional-recommended-bump', function (opt, parserOpts, cb) {
if (typeof bump === 'function') bump(opt, parserOpts, cb)
else if (bump instanceof Error) cb(bump)
else cb(null, { releaseType: bump })
})
Expand Down