Skip to content

Commit e234ccb

Browse files
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 <[email protected]>
1 parent 44526aa commit e234ccb

File tree

7 files changed

+32
-15
lines changed

7 files changed

+32
-15
lines changed

@commitlint/parse/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"dependencies": {
4242
"@commitlint/types": "^18.4.0",
43-
"conventional-changelog-angular": "^6.0.0",
43+
"conventional-changelog-angular": "^7.0.0",
4444
"conventional-commits-parser": "^5.0.0"
4545
},
4646
"gitHead": "70f7f4688b51774e7ac5e40e896cdaa3f132b2bc"

@commitlint/parse/src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export async function parse(
88
parser: Parser = sync,
99
parserOpts?: ParserOptions
1010
): Promise<Commit> {
11-
const defaultOpts = (await defaultChangelogOpts).parserOpts;
11+
const preset = await defaultChangelogOpts();
12+
const defaultOpts = preset.parserOpts;
1213
const opts = {
1314
...defaultOpts,
1415
fieldPattern: null,

@commitlint/rules/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@commitlint/parse": "^18.4.0",
3939
"@commitlint/test": "^18.0.0",
4040
"@commitlint/utils": "^18.4.0",
41-
"conventional-changelog-angular": "6.0.0",
41+
"conventional-changelog-angular": "7.0.0",
4242
"glob": "^8.0.3"
4343
},
4444
"dependencies": {

@commitlint/rules/src/references-empty.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const messages = {
1212
};
1313

1414
const opts = (async () => {
15-
const o = await preset;
15+
const o = await preset();
1616
o.parserOpts.commentChar = '#';
1717
return o;
1818
})();

@commitlint/rules/src/scope-enum.test.ts

+22-6
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ test('scope-enum with plain message and always should succeed empty enum', async
2424
});
2525

2626
test('scope-enum with plain message and never should error empty enum', async () => {
27-
const [actual] = scopeEnum(await parsed.plain, 'never', []);
27+
const [actual, message] = scopeEnum(await parsed.plain, 'never', []);
2828
const expected = false;
2929
expect(actual).toEqual(expected);
30+
expect(message).toEqual('scope must not be one of []');
3031
});
3132

3233
test('with plain message should succeed correct enum', async () => {
@@ -36,15 +37,17 @@ test('with plain message should succeed correct enum', async () => {
3637
});
3738

3839
test('scope-enum with plain message should error false enum', async () => {
39-
const [actual] = scopeEnum(await parsed.plain, 'always', ['foo']);
40+
const [actual, message] = scopeEnum(await parsed.plain, 'always', ['foo']);
4041
const expected = false;
4142
expect(actual).toEqual(expected);
43+
expect(message).toEqual('scope must be one of [foo]');
4244
});
4345

4446
test('scope-enum with plain message should error forbidden enum', async () => {
45-
const [actual] = scopeEnum(await parsed.plain, 'never', ['bar']);
47+
const [actual, message] = scopeEnum(await parsed.plain, 'never', ['bar']);
4648
const expected = false;
4749
expect(actual).toEqual(expected);
50+
expect(message).toEqual('scope must not be one of [bar]');
4851
});
4952

5053
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 ()
9598
expect(actual).toEqual(expected);
9699
});
97100

98-
test('scope-enum with multiple scopes should succeed on message with multiple scopes', async () => {
99-
const [actual] = scopeEnum(await parsed.multiple, 'never', ['bar', 'baz']);
101+
test('scope-enum with multiple scopes should error on message with multiple scopes', async () => {
102+
const [actual, message] = scopeEnum(await parsed.multiple, 'never', [
103+
'bar',
104+
'baz',
105+
]);
100106
const expected = false;
101107
expect(actual).toEqual(expected);
108+
expect(message).toEqual('scope must not be one of [bar, baz]');
102109
});
103110

104111
test('scope-enum with multiple scopes should error on message with forbidden enum', async () => {
105-
const [actual] = scopeEnum(await parsed.multiple, 'never', ['bar', 'qux']);
112+
const [actual, message] = scopeEnum(await parsed.multiple, 'never', [
113+
'bar',
114+
'qux',
115+
]);
106116
const expected = true;
107117
expect(actual).toEqual(expected);
108118
});
@@ -113,6 +123,12 @@ test('scope-enum with multiple scopes should error on message with superfluous s
113123
expect(actual).toEqual(expected);
114124
});
115125

126+
test('scope-enum with multiple scope should succeed on message with multiple scopes', async () => {
127+
const [actual] = scopeEnum(await parsed.multiple, 'always', ['bar', 'baz']);
128+
const expected = true;
129+
expect(actual).toEqual(expected);
130+
});
131+
116132
test('scope-enum with multiple scope with comma+space should succeed on message with multiple scopes', async () => {
117133
const [actual] = scopeEnum(await parsed.multipleCommaSpace, 'always', [
118134
'bar',

@commitlint/rules/src/subject-exclamation-mark.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {subjectExclamationMark} from './subject-exclamation-mark';
44
const preset = require('conventional-changelog-angular');
55

66
const parseMessage = async (str: string) => {
7-
const {parserOpts} = await preset;
7+
const {parserOpts} = await preset();
88
return parse(str, undefined, parserOpts);
99
};
1010

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -3210,10 +3210,10 @@ console-control-strings@^1.1.0:
32103210
resolved "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
32113211
integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==
32123212

3213-
conventional-changelog-angular@6.0.0, conventional-changelog-angular@^6.0.0:
3214-
version "6.0.0"
3215-
resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz#a9a9494c28b7165889144fd5b91573c4aa9ca541"
3216-
integrity sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg==
3213+
conventional-changelog-angular@7.0.0, conventional-changelog-angular@^7.0.0:
3214+
version "7.0.0"
3215+
resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz#5eec8edbff15aa9b1680a8dcfbd53e2d7eb2ba7a"
3216+
integrity sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==
32173217
dependencies:
32183218
compare-func "^2.0.0"
32193219

0 commit comments

Comments
 (0)