build: make commit validation accept typical Revert messages (#23480)

fixes #23479

PR Close #23480
This commit is contained in:
Victor Berchet
2018-04-20 18:03:41 -07:00
parent 6761a64522
commit a35bf114eb
2 changed files with 25 additions and 16 deletions

View File

@ -98,20 +98,26 @@ describe('validate-commit-message.js', function() {
});
it('should support "revert: type(scope):" syntax and reject "revert(scope):" syntax',
function() {
let correctMsg = 'revert: fix(compiler): reduce generated code payload size by 65%';
expect(validateMessage(correctMsg)).toBe(VALID);
it('should support "revert: type(scope):" syntax', function() {
const correctMsg = 'revert: fix(compiler): reduce generated code payload size by 65%';
expect(validateMessage(correctMsg)).toBe(VALID);
});
let incorretMsg = 'revert(compiler): reduce generated code payload size by 65%';
expect(validateMessage(incorretMsg)).toBe(INVALID);
expect(errors).toEqual([
'INVALID COMMIT MSG: "revert(compiler): reduce generated code payload size by 65%"\n' +
it('should support reject "revert(scope):" syntax', function() {
const incorretMsg = 'revert(compiler): reduce generated code payload size by 65%';
expect(validateMessage(incorretMsg)).toBe(INVALID);
expect(errors).toEqual(
['INVALID COMMIT MSG: "revert(compiler): reduce generated code payload size by 65%"\n' +
' => ERROR: revert is not an allowed type.\n' +
' => TYPES: ' + TYPES
]);
});
' => TYPES: ' + TYPES]);
});
// https://github.com/angular/angular/issues/23479
it('should support typical Angular messages generated by git', function() {
const correctMsg =
'Revert "fix(compiler): Pretty print object instead of [Object object] (#22689)" (#23442)';
expect(validateMessage(correctMsg)).toBe(VALID);
});
it('should validate type', function() {
expect(validateMessage('weird($filter): something')).toBe(INVALID);