-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use conventional-recommended-bump to support --detect-release
- Loading branch information
1 parent
bf86499
commit 4383381
Showing
7 changed files
with
127 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* global describe it beforeEach afterEach */ | ||
|
||
'use strict' | ||
|
||
const { bumpVersion } = require('../lib/lifecycles/bump') | ||
const shell = require('shelljs') | ||
const chai = require('chai') | ||
const { expect } = chai | ||
|
||
describe('bumpVersion', () => { | ||
const args = { | ||
types: [ | ||
{ type: 'feat', section: 'Features' }, | ||
{ type: 'test', section: 'Tests', hidden: true } | ||
] | ||
} | ||
|
||
beforeEach(() => { | ||
shell.rm('-rf', 'tmp') | ||
shell.config.silent = true | ||
shell.mkdir('tmp') | ||
shell.cd('tmp') | ||
shell.exec('git init') | ||
shell.exec('git config commit.gpgSign false') | ||
shell.exec('git config core.autocrlf false') | ||
}) | ||
|
||
afterEach(() => { | ||
shell.cd('../') | ||
shell.rm('-rf', 'tmp') | ||
}) | ||
|
||
describe('when a tag is avaialble', () => { | ||
let result | ||
|
||
beforeEach(async () => { | ||
shell.exec('git commit --allow-empty -m "first-commit"') | ||
shell.exec('git tag 1.2.3') | ||
}) | ||
|
||
describe('and release commits are present', () => { | ||
beforeEach(async () => { | ||
shell.exec('git commit --allow-empty -m "feat: second-commit"') | ||
|
||
result = await bumpVersion(null, '1.2.3', args) | ||
}) | ||
|
||
it('should return a release recommendation', async () => { | ||
expect(result).to.include({ level: 1, releaseType: 'minor' }) | ||
}) | ||
}) | ||
|
||
describe('and no release commits are present', () => { | ||
beforeEach(async () => { | ||
shell.exec('git commit --allow-empty -m "test: second-commit"') | ||
|
||
result = await bumpVersion(null, '1.2.3', args) | ||
}) | ||
|
||
it('should return no release', async () => { | ||
expect(result).to.include({ | ||
level: null, | ||
reason: 'No commits found for types: [feat], skipping release stage.' | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('when no tag is found', () => { | ||
let result | ||
|
||
beforeEach(async () => { | ||
shell.exec('git commit --allow-empty -m "first-commit"') | ||
shell.exec('git commit --allow-empty -m "second-commit"') | ||
|
||
result = await bumpVersion(null, '1.2.3', args) | ||
}) | ||
|
||
it('should return no release', async () => { | ||
expect(result).to.include({ | ||
level: null, | ||
reason: 'No commits found for types: [feat], skipping release stage.' | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.