Skip to content

Commit

Permalink
test(app): test for --ci
Browse files Browse the repository at this point in the history
unit test for --ci parameter
  • Loading branch information
Nicolas Guilhaudin committed Feb 25, 2019
1 parent da75cc6 commit 7a64509
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/system.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7a64509

Please sign in to comment.