From f92677b09273f619564ebde4b8ca2007246e5cd1 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Mon, 12 Feb 2018 00:42:53 -0500 Subject: [PATCH] fix: log current version of semantic-release --- index.js | 2 ++ test/index.test.js | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 61ef9626..bb1f73fb 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ const marked = require('marked'); const TerminalRenderer = require('marked-terminal'); const envCi = require('env-ci'); const hookStd = require('hook-std'); +const pkg = require('./package.json'); const hideSensitive = require('./lib/hide-sensitive'); const getConfig = require('./lib/get-config'); const verify = require('./lib/verify'); @@ -140,6 +141,7 @@ async function callFail(plugins, options, error) { } module.exports = async opts => { + logger.log(`Running %s version %s`, pkg.name, pkg.version); const unhook = hookStd({silent: false}, hideSensitive); try { const config = await getConfig(opts, logger); diff --git a/test/index.test.js b/test/index.test.js index a6db4015..91603498 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -475,7 +475,7 @@ test.serial('Force a dry-run if not on a CI and "noCi" is not explicitly set', a }); t.truthy(await semanticRelease(options)); - t.is(t.context.log.args[0][0], 'This run was not triggered in a known CI environment, running in dry-run mode.'); + t.is(t.context.log.args[1][0], 'This run was not triggered in a known CI environment, running in dry-run mode.'); t.is(verifyConditions.callCount, 1); t.is(analyzeCommits.callCount, 1); t.is(verifyRelease.callCount, 1); @@ -596,7 +596,7 @@ test.serial('Returns falsy value if triggered by a PR', async t => { t.falsy(await semanticRelease({repositoryUrl})); t.is( - t.context.log.args[8][0], + t.context.log.args[9][0], "This run was triggered by a pull request and therefore a new version won't be published." ); }); @@ -623,7 +623,7 @@ test.serial('Returns falsy value if not running from the configured branch', asy t.falsy(await semanticRelease(options)); t.is( - t.context.log.args[0][0], + t.context.log.args[1][0], '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.' ); }); @@ -661,7 +661,7 @@ test.serial('Returns falsy value if there is no relevant changes', async t => { t.is(verifyRelease.callCount, 0); t.is(generateNotes.callCount, 0); t.is(publish.callCount, 0); - t.is(t.context.log.args[6][0], 'There are no relevant changes, so no new version is released.'); + t.is(t.context.log.args[7][0], 'There are no relevant changes, so no new version is released.'); }); 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 await t.throws(semanticRelease(options)); - t.regex(t.context.stdout.args[8][0], /Console: The token \[secure\] is invalid/); - t.regex(t.context.stdout.args[9][0], /Log: The token \[secure\] is invalid/); + t.regex(t.context.stdout.args[9][0], /Console: The token \[secure\] is invalid/); + t.regex(t.context.stdout.args[10][0], /Log: The token \[secure\] is invalid/); t.regex(t.context.stderr.args[0][0], /Error: The token \[secure\] is invalid/); t.regex(t.context.stderr.args[1][0], /Invalid token \[secure\]/); });