Skip to content

Commit

Permalink
[bug fix] tagName being ignored (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
zshannon committed Mar 31, 2020
1 parent 0833082 commit 413068e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/plugin/GitBase.js
Expand Up @@ -15,7 +15,7 @@ class GitBase extends Plugin {
await this.fetch();
const repo = parseGitUrl(this.remoteUrl);
const latestTagName = await this.getLatestTagName();
const tagName = this.options.tagName || (latestTagName || '').match(/^v/) ? 'v${version}' : '${version}';
const tagName = this.options.tagName || ((latestTagName || '').match(/^v/) ? 'v${version}' : '${version}');
const changelog = await this.getChangelog(latestTagName);
this.setContext({ repo, latestTagName, tagName, changelog });
}
Expand Down
8 changes: 8 additions & 0 deletions test/git.init.js
Expand Up @@ -99,6 +99,14 @@ test.serial('should detect include version prefix (without "v")', async t => {
t.is(gitClient.getContext('tagName'), '1.0.1');
});

test.serial('should honor tagName configuration', async t => {
const gitClient = factory(Git, { options: { git: { tagName: 'TAGNAME-v${version}' } } });
sh.exec('git tag 1.0.0');
await gitClient.init();
await gitClient.bump('1.0.1');
t.is(gitClient.getContext('tagName'), 'TAGNAME-v1.0.1');
});

test.serial('should detect include version prefix (configured)', async t => {
const gitClient = factory(Git, { options: { git: { tagName: 'v${version}' } } });
sh.exec('git tag 1.0.0');
Expand Down

0 comments on commit 413068e

Please sign in to comment.