forked from commitizen/cz-conventional-changelog
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from ashwinaggarwal/topic/add-skip-to-commit-me…
…ssage-to-skip-build feat(engine): allow user to add [skip-ci] in head of commit message #5
- Loading branch information
Showing
5 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Engine should add [skip-ci] to commit message head if user said yes to skip deployment 1`] = ` | ||
"chore(buildspec): [skip-ci] This is a test message | ||
fix #Issue01" | ||
`; | ||
|
||
exports[`Engine should not add [skip-ci] to commit message head if user said no (default) to skip deployment 1`] = ` | ||
"chore(buildspec): This is a test message | ||
fix #Issue01" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
describe('Engine', () => { | ||
let engine = require('../index'); | ||
let answersMock = { | ||
type: 'chore', | ||
scope: 'buildspec', | ||
subject: 'This is a test message', | ||
body: '', | ||
isBreaking: false, | ||
needDeployment: true, | ||
isIssueAffected: true, | ||
issues: 'fix #Issue01' | ||
}; | ||
|
||
let cz = { | ||
prompt: jest.fn() | ||
}; | ||
|
||
beforeEach(() => { | ||
cz.prompt.mockReset(); | ||
}); | ||
|
||
test('should not add [skip-ci] to commit message head if user said no (default) to skip deployment', (done) => { | ||
cz.prompt.mockReturnValue(Promise.resolve(answersMock)); | ||
engine.prompter(cz, (commitMessage) => { | ||
expect(commitMessage).toMatchSnapshot(); | ||
expect(/\[skip-ci\]/g.test(commitMessage)).toBeFalsy(); | ||
done(); | ||
}); | ||
}); | ||
|
||
test('should add [skip-ci] to commit message head if user said yes to skip deployment', (done) => { | ||
cz.prompt.mockReturnValue(Promise.resolve({ | ||
...answersMock, | ||
needDeployment: false | ||
})); | ||
engine.prompter(cz, (commitMessage) => { | ||
expect(commitMessage).toMatchSnapshot(); | ||
expect(/\[skip-ci\]/g.test(commitMessage)).toBeTruthy(); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters