From e234ccb8dd4d38a874c3a18a5cf4da02cdab8808 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 21 Nov 2023 03:26:17 +0100 Subject: [PATCH] chore: update dependency conventional-changelog-angular to v7 (#3690) * chore: update dependency conventional-changelog-angular to v7 * Renovate/conventional changelog angular 7.x (#3725) * chore: update dependency conventional-changelog-angular to v7 * test: update conventional-changelog-angular unit tests * test: improve scope-enum unit tests --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Alessandro Rabitti --- @commitlint/parse/package.json | 2 +- @commitlint/parse/src/index.ts | 3 +- @commitlint/rules/package.json | 2 +- .../rules/src/references-empty.test.ts | 2 +- @commitlint/rules/src/scope-enum.test.ts | 28 +++++++++++++++---- .../src/subject-exclamation-mark.test.ts | 2 +- yarn.lock | 8 +++--- 7 files changed, 32 insertions(+), 15 deletions(-) diff --git a/@commitlint/parse/package.json b/@commitlint/parse/package.json index cac8b207f3..56d99db69a 100644 --- a/@commitlint/parse/package.json +++ b/@commitlint/parse/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@commitlint/types": "^18.4.0", - "conventional-changelog-angular": "^6.0.0", + "conventional-changelog-angular": "^7.0.0", "conventional-commits-parser": "^5.0.0" }, "gitHead": "70f7f4688b51774e7ac5e40e896cdaa3f132b2bc" diff --git a/@commitlint/parse/src/index.ts b/@commitlint/parse/src/index.ts index 52b3ac17a8..1aabfdced9 100644 --- a/@commitlint/parse/src/index.ts +++ b/@commitlint/parse/src/index.ts @@ -8,7 +8,8 @@ export async function parse( parser: Parser = sync, parserOpts?: ParserOptions ): Promise { - const defaultOpts = (await defaultChangelogOpts).parserOpts; + const preset = await defaultChangelogOpts(); + const defaultOpts = preset.parserOpts; const opts = { ...defaultOpts, fieldPattern: null, diff --git a/@commitlint/rules/package.json b/@commitlint/rules/package.json index b3949d0730..9140201e6b 100644 --- a/@commitlint/rules/package.json +++ b/@commitlint/rules/package.json @@ -38,7 +38,7 @@ "@commitlint/parse": "^18.4.0", "@commitlint/test": "^18.0.0", "@commitlint/utils": "^18.4.0", - "conventional-changelog-angular": "6.0.0", + "conventional-changelog-angular": "7.0.0", "glob": "^8.0.3" }, "dependencies": { diff --git a/@commitlint/rules/src/references-empty.test.ts b/@commitlint/rules/src/references-empty.test.ts index 90073cb4dc..510e4b9309 100644 --- a/@commitlint/rules/src/references-empty.test.ts +++ b/@commitlint/rules/src/references-empty.test.ts @@ -12,7 +12,7 @@ const messages = { }; const opts = (async () => { - const o = await preset; + const o = await preset(); o.parserOpts.commentChar = '#'; return o; })(); diff --git a/@commitlint/rules/src/scope-enum.test.ts b/@commitlint/rules/src/scope-enum.test.ts index b5abb87481..56b52cfa43 100644 --- a/@commitlint/rules/src/scope-enum.test.ts +++ b/@commitlint/rules/src/scope-enum.test.ts @@ -24,9 +24,10 @@ test('scope-enum with plain message and always should succeed empty enum', async }); test('scope-enum with plain message and never should error empty enum', async () => { - const [actual] = scopeEnum(await parsed.plain, 'never', []); + const [actual, message] = scopeEnum(await parsed.plain, 'never', []); const expected = false; expect(actual).toEqual(expected); + expect(message).toEqual('scope must not be one of []'); }); test('with plain message should succeed correct enum', async () => { @@ -36,15 +37,17 @@ test('with plain message should succeed correct enum', async () => { }); test('scope-enum with plain message should error false enum', async () => { - const [actual] = scopeEnum(await parsed.plain, 'always', ['foo']); + const [actual, message] = scopeEnum(await parsed.plain, 'always', ['foo']); const expected = false; expect(actual).toEqual(expected); + expect(message).toEqual('scope must be one of [foo]'); }); test('scope-enum with plain message should error forbidden enum', async () => { - const [actual] = scopeEnum(await parsed.plain, 'never', ['bar']); + const [actual, message] = scopeEnum(await parsed.plain, 'never', ['bar']); const expected = false; expect(actual).toEqual(expected); + expect(message).toEqual('scope must not be one of [bar]'); }); test('scope-enum with plain message should succeed forbidden enum', async () => { @@ -95,14 +98,21 @@ test('scope-enum with empty scope and never should succeed empty enum', async () expect(actual).toEqual(expected); }); -test('scope-enum with multiple scopes should succeed on message with multiple scopes', async () => { - const [actual] = scopeEnum(await parsed.multiple, 'never', ['bar', 'baz']); +test('scope-enum with multiple scopes should error on message with multiple scopes', async () => { + const [actual, message] = scopeEnum(await parsed.multiple, 'never', [ + 'bar', + 'baz', + ]); const expected = false; expect(actual).toEqual(expected); + expect(message).toEqual('scope must not be one of [bar, baz]'); }); test('scope-enum with multiple scopes should error on message with forbidden enum', async () => { - const [actual] = scopeEnum(await parsed.multiple, 'never', ['bar', 'qux']); + const [actual, message] = scopeEnum(await parsed.multiple, 'never', [ + 'bar', + 'qux', + ]); const expected = true; expect(actual).toEqual(expected); }); @@ -113,6 +123,12 @@ test('scope-enum with multiple scopes should error on message with superfluous s expect(actual).toEqual(expected); }); +test('scope-enum with multiple scope should succeed on message with multiple scopes', async () => { + const [actual] = scopeEnum(await parsed.multiple, 'always', ['bar', 'baz']); + const expected = true; + expect(actual).toEqual(expected); +}); + test('scope-enum with multiple scope with comma+space should succeed on message with multiple scopes', async () => { const [actual] = scopeEnum(await parsed.multipleCommaSpace, 'always', [ 'bar', diff --git a/@commitlint/rules/src/subject-exclamation-mark.test.ts b/@commitlint/rules/src/subject-exclamation-mark.test.ts index 1b36eb8e3b..3c032906e1 100644 --- a/@commitlint/rules/src/subject-exclamation-mark.test.ts +++ b/@commitlint/rules/src/subject-exclamation-mark.test.ts @@ -4,7 +4,7 @@ import {subjectExclamationMark} from './subject-exclamation-mark'; const preset = require('conventional-changelog-angular'); const parseMessage = async (str: string) => { - const {parserOpts} = await preset; + const {parserOpts} = await preset(); return parse(str, undefined, parserOpts); }; diff --git a/yarn.lock b/yarn.lock index 49449b41a1..2396f59fc6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3210,10 +3210,10 @@ console-control-strings@^1.1.0: resolved "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== -conventional-changelog-angular@6.0.0, conventional-changelog-angular@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz#a9a9494c28b7165889144fd5b91573c4aa9ca541" - integrity sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg== +conventional-changelog-angular@7.0.0, conventional-changelog-angular@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz#5eec8edbff15aa9b1680a8dcfbd53e2d7eb2ba7a" + integrity sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ== dependencies: compare-func "^2.0.0"