Skip to content
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

[bug fix] tagName being ignored #634

Merged
merged 2 commits into from Mar 31, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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