From 7a64509f14f92754f1a299724b0abba3608eb224 Mon Sep 17 00:00:00 2001 From: Nicolas Guilhaudin Date: Mon, 25 Feb 2019 18:39:11 +0100 Subject: [PATCH] test(app): test for --ci unit test for --ci parameter --- spec/system.spec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/system.spec.js b/spec/system.spec.js index 6a4183c..a0fd593 100644 --- a/spec/system.spec.js +++ b/spec/system.spec.js @@ -59,6 +59,15 @@ describe('corp-semantic-release', function() { expect(gitStatus).to.match(/nothing to commit, working (directory|tree) clean/); }); + it('should not change add no-ci message when ci parameter is specified', function() { + commitFeat(); + const result = semanticRelease(`--ci`); + expect(result.code).to.be.equal(0); + + const expectedVersion = '1.0.0'; + // check Semantic Tag + expectedCIGitTag(expectedVersion); + }); it('should bump minor version, create CHANGELOG.md file and semantic tag correctly', function() { commitFeat(); @@ -480,6 +489,16 @@ describe('corp-semantic-release', function() { expect(gitTag).to.include(expectedPrefix + 'v' + expectedVersion); } + function expectedCIGitTag(expectedVersion, expectedPrefix) { + expectedPrefix = expectedPrefix || ''; + // check for new commit without ci skip string + let gitLog = shell.exec('git log -1 --pretty=%B | cat').stdout; + expect(gitLog.trim()).to.equal(`chore(release): ${expectedPrefix}v${expectedVersion}`); + + let gitTag = shell.exec('git tag | cat').stdout; + expect(gitTag).to.include(expectedPrefix + 'v' + expectedVersion); + } + function expectedVersionInPackageJson(expectedVersion) { let newVersion = require(tempDir + '/package.json').version; expect(newVersion).to.equal(expectedVersion);