Skip to content

Commit

Permalink
fix: correct log when adding channel to tag
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Dec 10, 2019
1 parent a8747c4 commit 61665be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
6 changes: 5 additions & 1 deletion index.js
Expand Up @@ -112,7 +112,11 @@ async function run(context, plugins) {
await addNote({channels: [...currentRelease.channels, nextRelease.channel]}, nextRelease.gitHead, {cwd, env});
await push(options.repositoryUrl, {cwd, env});
await pushNotes(options.repositoryUrl, {cwd, env});
logger.success(`Add channel ${nextRelease.channel} to tag ${nextRelease.gitTag}`);
logger.success(
`Add ${nextRelease.channel ? `channel ${nextRelease.channel}` : 'default channel'} to tag ${
nextRelease.gitTag
}`
);
}

context.branch.tags.push({
Expand Down
21 changes: 14 additions & 7 deletions test/index.test.js
Expand Up @@ -785,7 +785,14 @@ async function addChannelMacro(t, mergeFunction) {
const publish = stub().resolves();
const success = stub().resolves();

const config = {branches: [{name: 'master'}, {name: 'next'}], repositoryUrl, tagFormat: `v\${version}`};
const config = {
branches: [
{name: 'master', channel: 'latest'},
{name: 'next', channel: 'next'},
],
repositoryUrl,
tagFormat: `v\${version}`,
};
const options = {
...config,
verifyConditions,
Expand All @@ -796,11 +803,11 @@ async function addChannelMacro(t, mergeFunction) {
publish,
success,
};
const nextRelease2 = {
const nextRelease = {
name: 'v2.0.1',
type: 'patch',
version: '2.0.1',
channel: null,
channel: 'latest',
gitTag: 'v2.0.1',
gitHead: commits[2].hash,
};
Expand All @@ -812,13 +819,13 @@ async function addChannelMacro(t, mergeFunction) {
const result = await semanticRelease(options, {cwd, env: {}, stdout: {write: () => {}}, stderr: {write: () => {}}});

t.deepEqual(result.releases, [
{...nextRelease2, ...release1, notes, pluginName: '[Function: functionStub]'},
{...nextRelease2, notes, pluginName: '[Function: functionStub]'},
{...nextRelease, ...release1, notes, pluginName: '[Function: functionStub]'},
{...nextRelease, notes, pluginName: '[Function: functionStub]'},
]);

// Verify the tag has been created on the local and remote repo and reference
t.is(await gitTagHead(nextRelease2.gitTag, {cwd}), nextRelease2.gitHead);
t.is(await gitRemoteTagHead(repositoryUrl, nextRelease2.gitTag, {cwd}), nextRelease2.gitHead);
t.is(await gitTagHead(nextRelease.gitTag, {cwd}), nextRelease.gitHead);
t.is(await gitRemoteTagHead(repositoryUrl, nextRelease.gitTag, {cwd}), nextRelease.gitHead);
}

addChannelMacro.title = providedTitle => `Add version to a channel after a merge (${providedTitle})`;
Expand Down

0 comments on commit 61665be

Please sign in to comment.