diff --git a/@commitlint/ensure/src/enum.test.ts b/@commitlint/ensure/src/enum.test.ts index 599234021a..ab7d5d0ff7 100644 --- a/@commitlint/ensure/src/enum.test.ts +++ b/@commitlint/ensure/src/enum.test.ts @@ -5,6 +5,11 @@ test('false for no params', () => { expect(actual).toBe(false); }); +test('false for not array enums', () => { + const actual = ensure('a', 'a' as any); + expect(actual).toBe(false); +}); + test('true for a against a', () => { const actual = ensure('a', ['a']); expect(actual).toBe(true); diff --git a/@commitlint/is-ignored/src/is-ignored.test.ts b/@commitlint/is-ignored/src/is-ignored.test.ts index 663080223b..e50524dc9c 100644 --- a/@commitlint/is-ignored/src/is-ignored.test.ts +++ b/@commitlint/is-ignored/src/is-ignored.test.ts @@ -150,7 +150,7 @@ test('should throw error if ignores is not an array', () => { isIgnored(ignoredString, { ignores: 'throws error' } as any); - }).toThrow(); + }).toThrow('ignores must be of type array, received '); }); test('should return true for custom ignores as function', () => { @@ -161,3 +161,12 @@ test('should return true for custom ignores as function', () => { }) ).toBe(true); }); + +test('should throw error if any element of ignores is not a function', () => { + const ignoredString = 'this should be ignored'; + expect(() => { + isIgnored(ignoredString, { + ignores: ['throws error'] + } as any); + }).toThrow('ignores must be array of type function, received items of type:'); +});