Skip to content

Commit f92677b

Browse files
pvdlggr2m
authored andcommitted
fix: log current version of semantic-release
1 parent 9dd127b commit f92677b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

index.js

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const marked = require('marked');
33
const TerminalRenderer = require('marked-terminal');
44
const envCi = require('env-ci');
55
const hookStd = require('hook-std');
6+
const pkg = require('./package.json');
67
const hideSensitive = require('./lib/hide-sensitive');
78
const getConfig = require('./lib/get-config');
89
const verify = require('./lib/verify');
@@ -140,6 +141,7 @@ async function callFail(plugins, options, error) {
140141
}
141142

142143
module.exports = async opts => {
144+
logger.log(`Running %s version %s`, pkg.name, pkg.version);
143145
const unhook = hookStd({silent: false}, hideSensitive);
144146
try {
145147
const config = await getConfig(opts, logger);

test/index.test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ test.serial('Force a dry-run if not on a CI and "noCi" is not explicitly set', a
475475
});
476476
t.truthy(await semanticRelease(options));
477477

478-
t.is(t.context.log.args[0][0], 'This run was not triggered in a known CI environment, running in dry-run mode.');
478+
t.is(t.context.log.args[1][0], 'This run was not triggered in a known CI environment, running in dry-run mode.');
479479
t.is(verifyConditions.callCount, 1);
480480
t.is(analyzeCommits.callCount, 1);
481481
t.is(verifyRelease.callCount, 1);
@@ -596,7 +596,7 @@ test.serial('Returns falsy value if triggered by a PR', async t => {
596596

597597
t.falsy(await semanticRelease({repositoryUrl}));
598598
t.is(
599-
t.context.log.args[8][0],
599+
t.context.log.args[9][0],
600600
"This run was triggered by a pull request and therefore a new version won't be published."
601601
);
602602
});
@@ -623,7 +623,7 @@ test.serial('Returns falsy value if not running from the configured branch', asy
623623

624624
t.falsy(await semanticRelease(options));
625625
t.is(
626-
t.context.log.args[0][0],
626+
t.context.log.args[1][0],
627627
'This test run was triggered on the branch other-branch, while semantic-release is configured to only publish from master, therefore a new version won’t be published.'
628628
);
629629
});
@@ -661,7 +661,7 @@ test.serial('Returns falsy value if there is no relevant changes', async t => {
661661
t.is(verifyRelease.callCount, 0);
662662
t.is(generateNotes.callCount, 0);
663663
t.is(publish.callCount, 0);
664-
t.is(t.context.log.args[6][0], 'There are no relevant changes, so no new version is released.');
664+
t.is(t.context.log.args[7][0], 'There are no relevant changes, so no new version is released.');
665665
});
666666

667667
test.serial('Exclude commits with [skip release] or [release skip] from analysis', async t => {
@@ -723,8 +723,8 @@ test.serial('Hide sensitive environment variable values from the logs', async t
723723

724724
await t.throws(semanticRelease(options));
725725

726-
t.regex(t.context.stdout.args[8][0], /Console: The token \[secure\] is invalid/);
727-
t.regex(t.context.stdout.args[9][0], /Log: The token \[secure\] is invalid/);
726+
t.regex(t.context.stdout.args[9][0], /Console: The token \[secure\] is invalid/);
727+
t.regex(t.context.stdout.args[10][0], /Log: The token \[secure\] is invalid/);
728728
t.regex(t.context.stderr.args[0][0], /Error: The token \[secure\] is invalid/);
729729
t.regex(t.context.stderr.args[1][0], /Invalid token \[secure\]/);
730730
});

0 commit comments

Comments
 (0)