@commitlint/format 7.3.1 → 7.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -8
- package/README.md +1 -1
- package/lib/index.js +7 -8
- package/lib/index.js.map +1 -1
- package/lib/index.test.js +40 -1
- package/lib/index.test.js.map +1 -1
- package/package.json +10 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,8 +3,55 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.6.1](https://github.com/conventional-changelog/commitlint/compare/v7.6.0...v7.6.1) (2019-05-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* ensure format() is available as commonjs default export [#645](https://github.com/conventional-changelog/commitlint/issues/645) ([ec3da92](https://github.com/conventional-changelog/commitlint/commit/ec3da92))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* avoid excessive help text [#606](https://github.com/conventional-changelog/commitlint/issues/606) ([#637](https://github.com/conventional-changelog/commitlint/issues/637)) ([8f3c3b1](https://github.com/conventional-changelog/commitlint/commit/8f3c3b1))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<a name="7.5.0"></a>
|
|
29
|
+
# [7.5.0](https://github.com/conventional-changelog/commitlint/compare/v7.4.0...v7.5.0) (2019-01-31)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* all broken website references ([#564](https://github.com/conventional-changelog/commitlint/issues/564)) ([82eeb5a](https://github.com/conventional-changelog/commitlint/commit/82eeb5a))
|
|
35
|
+
* cleanup message for input with no config ([#519](https://github.com/conventional-changelog/commitlint/issues/519)) ([7d9e760](https://github.com/conventional-changelog/commitlint/commit/7d9e760))
|
|
36
|
+
* replace all repository references with conventional changelog ([#561](https://github.com/conventional-changelog/commitlint/issues/561)) ([6c3afcd](https://github.com/conventional-changelog/commitlint/commit/6c3afcd))
|
|
37
|
+
* replace all website references with conventional changelog ([#563](https://github.com/conventional-changelog/commitlint/issues/563)) ([6b86fb1](https://github.com/conventional-changelog/commitlint/commit/6b86fb1))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<a name="7.4.0"></a>
|
|
43
|
+
# [7.4.0](https://github.com/conventional-changelog/commitlint/compare/v7.3.2...v7.4.0) (2019-01-27)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* correction to need help link ([#540](https://github.com/conventional-changelog/commitlint/issues/540)) ([fa6168a](https://github.com/conventional-changelog/commitlint/commit/fa6168a))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
6
53
|
<a name="7.3.1"></a>
|
|
7
|
-
## [7.3.1](https://github.com/
|
|
54
|
+
## [7.3.1](https://github.com/conventional-changelog/commitlint/compare/v7.3.0...v7.3.1) (2019-01-11)
|
|
8
55
|
|
|
9
56
|
|
|
10
57
|
|
|
@@ -12,19 +59,19 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
12
59
|
**Note:** Version bump only for package @commitlint/format
|
|
13
60
|
|
|
14
61
|
<a name="7.3.0"></a>
|
|
15
|
-
# [7.3.0](https://github.com/
|
|
62
|
+
# [7.3.0](https://github.com/conventional-changelog/commitlint/compare/v7.2.1...v7.3.0) (2019-01-11)
|
|
16
63
|
|
|
17
64
|
|
|
18
65
|
### Bug Fixes
|
|
19
66
|
|
|
20
|
-
* **format:** add new line to result ([#518](https://github.com/
|
|
21
|
-
* update to security-patched dependency versions ([97c033b](https://github.com/
|
|
67
|
+
* **format:** add new line to result ([#518](https://github.com/conventional-changelog/commitlint/issues/518)) ([f1d443b](https://github.com/conventional-changelog/commitlint/commit/f1d443b)), closes [#504](https://github.com/conventional-changelog/commitlint/issues/504)
|
|
68
|
+
* update to security-patched dependency versions ([97c033b](https://github.com/conventional-changelog/commitlint/commit/97c033b))
|
|
22
69
|
|
|
23
70
|
|
|
24
71
|
|
|
25
72
|
|
|
26
73
|
<a name="7.2.1"></a>
|
|
27
|
-
## [7.2.1](https://github.com/
|
|
74
|
+
## [7.2.1](https://github.com/conventional-changelog/commitlint/compare/v7.2.0...v7.2.1) (2018-10-11)
|
|
28
75
|
|
|
29
76
|
|
|
30
77
|
|
|
@@ -32,7 +79,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
32
79
|
**Note:** Version bump only for package @commitlint/format
|
|
33
80
|
|
|
34
81
|
<a name="7.2.0"></a>
|
|
35
|
-
# [7.2.0](https://github.com/
|
|
82
|
+
# [7.2.0](https://github.com/conventional-changelog/commitlint/compare/v7.1.2...v7.2.0) (2018-10-05)
|
|
36
83
|
|
|
37
84
|
|
|
38
85
|
|
|
@@ -40,7 +87,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
40
87
|
**Note:** Version bump only for package @commitlint/format
|
|
41
88
|
|
|
42
89
|
<a name="7.1.2"></a>
|
|
43
|
-
## [7.1.2](https://github.com/
|
|
90
|
+
## [7.1.2](https://github.com/conventional-changelog/commitlint/compare/v7.1.1...v7.1.2) (2018-09-04)
|
|
44
91
|
|
|
45
92
|
|
|
46
93
|
|
|
@@ -48,7 +95,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
48
95
|
**Note:** Version bump only for package @commitlint/format
|
|
49
96
|
|
|
50
97
|
<a name="6.1.1"></a>
|
|
51
|
-
## [6.1.1](https://github.com/
|
|
98
|
+
## [6.1.1](https://github.com/conventional-changelog/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)
|
|
52
99
|
|
|
53
100
|
|
|
54
101
|
|
package/README.md
CHANGED
|
@@ -59,5 +59,5 @@ process.stdout.write(output);
|
|
|
59
59
|
] */
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
Consult [docs/api](
|
|
62
|
+
Consult [docs/api](https://conventional-changelog.github.io/commitlint/#/reference-api) for comprehensive documentation.
|
|
63
63
|
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = format;
|
|
7
|
-
|
|
8
3
|
var _chalk = require('chalk');
|
|
9
4
|
|
|
10
5
|
var _chalk2 = _interopRequireDefault(_chalk);
|
|
@@ -14,6 +9,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
9
|
const DEFAULT_SIGNS = [' ', '⚠', '✖'];
|
|
15
10
|
const DEFAULT_COLORS = ['white', 'yellow', 'red'];
|
|
16
11
|
|
|
12
|
+
module.exports = format;
|
|
13
|
+
module.exports.default = format;
|
|
14
|
+
module.exports.format = format;
|
|
15
|
+
module.exports.formatResult = formatResult;
|
|
16
|
+
|
|
17
17
|
function format(report = {}, options = {}) {
|
|
18
18
|
var _report$results = report.results;
|
|
19
19
|
const results = _report$results === undefined ? [] : _report$results;
|
|
@@ -42,7 +42,7 @@ function formatInput(result = {}, options = {}) {
|
|
|
42
42
|
|
|
43
43
|
const sign = '⧗';
|
|
44
44
|
const decoration = enabled ? _chalk2.default.gray(sign) : sign;
|
|
45
|
-
const commitText = errors.length > 0 ?
|
|
45
|
+
const commitText = errors.length > 0 ? input : input.split('\n')[0];
|
|
46
46
|
|
|
47
47
|
const decoratedInput = enabled ? _chalk2.default.bold(commitText) : commitText;
|
|
48
48
|
|
|
@@ -74,7 +74,7 @@ function formatResult(result = {}, options = {}) {
|
|
|
74
74
|
const color = selectColor({ errors, warnings });
|
|
75
75
|
|
|
76
76
|
const decoration = enabled ? _chalk2.default[color](sign) : sign;
|
|
77
|
-
const summary = `${decoration} found ${errors.length} problems, ${warnings.length} warnings \n (Need help? -> https://github.com/
|
|
77
|
+
const summary = `${decoration} found ${errors.length} problems, ${warnings.length} warnings \n (Need help? -> https://github.com/conventional-changelog/commitlint#what-is-commitlint )\n\n`;
|
|
78
78
|
return [...problems, enabled ? _chalk2.default.bold(summary) : summary];
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -91,5 +91,4 @@ function selectColor(result) {
|
|
|
91
91
|
}
|
|
92
92
|
return result.warnings.length ? 'yellow' : 'green';
|
|
93
93
|
}
|
|
94
|
-
module.exports = exports['default'];
|
|
95
94
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["format","
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["DEFAULT_SIGNS","DEFAULT_COLORS","module","exports","format","default","formatResult","report","options","results","length","map","result","formatInput","join","color","enabled","errors","input","sign","decoration","gray","commitText","split","decoratedInput","bold","signs","colors","warnings","problems","problem","level","name","grey","message","selectSign","selectColor","summary"],"mappings":";;AAAA;;;;;;AAEA,MAAMA,gBAAgB,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,CAAtB;AACA,MAAMC,iBAAiB,CAAC,OAAD,EAAU,QAAV,EAAoB,KAApB,CAAvB;;AAEAC,OAAOC,OAAP,GAAiBC,MAAjB;AACAF,OAAOC,OAAP,CAAeE,OAAf,GAAyBD,MAAzB;AACAF,OAAOC,OAAP,CAAeC,MAAf,GAAwBA,MAAxB;AACAF,OAAOC,OAAP,CAAeG,YAAf,GAA8BA,YAA9B;;AAEA,SAASF,MAAT,CAAgBG,SAAS,EAAzB,EAA6BC,UAAU,EAAvC,EA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B,KAAIA,OAAOK,MAAP,CAAcP,MAAd,GAAuB,CAA3B,EAA8B;AAC7B,SAAO,GAAP;AACA;AACD,QAAOE,OAAOgB,QAAP,CAAgBlB,MAAhB,GAAyB,GAAzB,GAA+B,GAAtC;AACA;;AAED,SAAS0B,WAAT,CAAqBxB,MAArB,EAA6B;AAC5B,KAAIA,OAAOK,MAAP,CAAcP,MAAd,GAAuB,CAA3B,EAA8B;AAC7B,SAAO,KAAP;AACA;AACD,QAAOE,OAAOgB,QAAP,CAAgBlB,MAAhB,GAAyB,QAAzB,GAAoC,OAA3C;AACA","file":"index.js","sourcesContent":["import chalk from 'chalk';\n\nconst DEFAULT_SIGNS = [' ', '⚠', '✖'];\nconst DEFAULT_COLORS = ['white', 'yellow', 'red'];\n\nmodule.exports = format;\nmodule.exports.default = format;\nmodule.exports.format = format;\nmodule.exports.formatResult = formatResult;\n\nfunction format(report = {}, options = {}) {\n\tconst {results = []} = report;\n\n\tif (results.length > 0) {\n\t\treturn results\n\t\t\t.map(\n\t\t\t\tresult =>\n\t\t\t\t\t`${formatInput(result, options)}${formatResult(result, options).join(\n\t\t\t\t\t\t'\\n'\n\t\t\t\t\t)}`\n\t\t\t)\n\t\t\t.join('\\n');\n\t}\n\n\t// Output a summary when nothing is found\n\treturn formatResult({}, options).join('\\n');\n}\n\nfunction formatInput(result = {}, options = {}) {\n\tconst {color: enabled = true} = options;\n\tconst {errors = [], input = ''} = result;\n\n\tif (!input) {\n\t\treturn '';\n\t}\n\n\tconst sign = '⧗';\n\tconst decoration = enabled ? chalk.gray(sign) : sign;\n\tconst commitText = errors.length > 0 ? input : input.split('\\n')[0];\n\n\tconst decoratedInput = enabled ? chalk.bold(commitText) : commitText;\n\n\treturn `\\n${decoration} input: ${decoratedInput}\\n`;\n}\n\nfunction formatResult(result = {}, options = {}) {\n\tconst {\n\t\tsigns = DEFAULT_SIGNS,\n\t\tcolors = DEFAULT_COLORS,\n\t\tcolor: enabled = true\n\t} = options;\n\tconst {errors = [], warnings = []} = result;\n\n\tconst problems = [...errors, ...warnings].map(problem => {\n\t\tconst sign = signs[problem.level] || '';\n\t\tconst color = colors[problem.level] || 'white';\n\t\tconst decoration = enabled ? chalk[color](sign) : sign;\n\t\tconst name = enabled\n\t\t\t? chalk.grey(`[${problem.name}]`)\n\t\t\t: `[${problem.name}]`;\n\t\treturn `${decoration} ${problem.message} ${name}`;\n\t});\n\n\tconst sign = selectSign({errors, warnings});\n\tconst color = selectColor({errors, warnings});\n\n\tconst decoration = enabled ? chalk[color](sign) : sign;\n\tconst summary = `${decoration} found ${errors.length} problems, ${\n\t\twarnings.length\n\t} warnings \\n (Need help? -> https://github.com/conventional-changelog/commitlint#what-is-commitlint )\\n\\n`;\n\treturn [...problems, enabled ? chalk.bold(summary) : summary];\n}\n\nfunction selectSign(result) {\n\tif (result.errors.length > 0) {\n\t\treturn '✖';\n\t}\n\treturn result.warnings.length ? '⚠' : '✔';\n}\n\nfunction selectColor(result) {\n\tif (result.errors.length > 0) {\n\t\treturn 'red';\n\t}\n\treturn result.warnings.length ? 'yellow' : 'green';\n}\n"]}
|
package/lib/index.test.js
CHANGED
|
@@ -16,7 +16,7 @@ var _2 = _interopRequireDefault(_);
|
|
|
16
16
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
|
|
19
|
-
const ok = _chalk2.default.bold(`${_chalk2.default.green('✔')} found 0 problems, 0 warnings \n (Need help? -> https://github.com/
|
|
19
|
+
const ok = _chalk2.default.bold(`${_chalk2.default.green('✔')} found 0 problems, 0 warnings \n (Need help? -> https://github.com/conventional-changelog/commitlint#what-is-commitlint )\n\n`);
|
|
20
20
|
|
|
21
21
|
(0, _ava2.default)('does nothing without arguments', t => {
|
|
22
22
|
const actual = (0, _2.default)();
|
|
@@ -121,4 +121,43 @@ const ok = _chalk2.default.bold(`${_chalk2.default.green('✔')} found 0 probl
|
|
|
121
121
|
t.true((0, _lodash.includes)(actualError, 'ERR'));
|
|
122
122
|
t.true((0, _lodash.includes)(actualWarning, 'WRN'));
|
|
123
123
|
});
|
|
124
|
+
|
|
125
|
+
(0, _ava2.default)('format result provides summary without arguments', t => {
|
|
126
|
+
const actual = (0, _.formatResult)();
|
|
127
|
+
const actualText = actual.join('\n');
|
|
128
|
+
|
|
129
|
+
t.true((0, _lodash.includes)(actualText, '0 problems, 0 warnings'));
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
(0, _ava2.default)('format result transforms error to text', t => {
|
|
133
|
+
const actual = (0, _.formatResult)({
|
|
134
|
+
errors: [{
|
|
135
|
+
level: 2,
|
|
136
|
+
name: 'error-name',
|
|
137
|
+
message: 'There was an error'
|
|
138
|
+
}]
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const actualText = actual.join('\n');
|
|
142
|
+
|
|
143
|
+
t.true((0, _lodash.includes)(actualText, 'error-name'));
|
|
144
|
+
t.true((0, _lodash.includes)(actualText, 'There was an error'));
|
|
145
|
+
t.true((0, _lodash.includes)(actualText, '1 problems, 0 warnings'));
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
(0, _ava2.default)('format result transforms warning to text', t => {
|
|
149
|
+
const actual = (0, _.formatResult)({
|
|
150
|
+
warnings: [{
|
|
151
|
+
level: 1,
|
|
152
|
+
name: 'warning-name',
|
|
153
|
+
message: 'There was a warning'
|
|
154
|
+
}]
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const actualText = actual.join('\n');
|
|
158
|
+
|
|
159
|
+
t.true((0, _lodash.includes)(actualText, 'warning-name'));
|
|
160
|
+
t.true((0, _lodash.includes)(actualText, 'There was a warning'));
|
|
161
|
+
t.true((0, _lodash.includes)(actualText, '0 problems, 1 warnings'));
|
|
162
|
+
});
|
|
124
163
|
//# sourceMappingURL=index.test.js.map
|
package/lib/index.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.test.js"],"names":["ok","bold","green","t","actual","deepEqual","results","errors","warnings","true","includes","actualError","level","name","message","actualWarning","options","signs"],"mappings":";;AAAA;;;;AACA;;;;AACA;;AACA;;;;;;AAEA,MAAMA,KAAK,gBAAMC,IAAN,CACT,GAAE,gBAAMC,KAAN,CACF,GADE,CAED,
|
|
1
|
+
{"version":3,"sources":["../src/index.test.js"],"names":["ok","bold","green","t","actual","deepEqual","results","errors","warnings","true","includes","actualError","level","name","message","actualWarning","options","signs","actualText","join"],"mappings":";;AAAA;;;;AACA;;;;AACA;;AACA;;;;;;AAEA,MAAMA,KAAK,gBAAMC,IAAN,CACT,GAAE,gBAAMC,KAAN,CACF,GADE,CAED,oIAHQ,CAAX;;AAMA,mBAAK,gCAAL,EAAuCC,KAAK;AAC3C,OAAMC,SAAS,iBAAf;AACAD,GAAEE,SAAF,CAAYD,MAAZ,EAAoBJ,EAApB;AACA,CAHD;;AAKA,mBAAK,qCAAL,EAA4CG,KAAK;AAChD,OAAMC,SAAS,gBAAO,EAACE,SAAS,EAAV,EAAP,CAAf;AACAH,GAAEE,SAAF,CAAYD,MAAZ,EAAoBJ,EAApB;AACA,CAHD;;AAKA,mBAAK,4CAAL,EAAmDG,KAAK;AACvD,OAAMC,SAAS,gBAAO,EAACE,SAAS,CAAC,EAAD,CAAV,EAAP,CAAf;AACAH,GAAEE,SAAF,CAAYD,MAAZ,EAAoBJ,EAApB;AACA,CAHD;;AAKA,mBAAK,mEAAL,EAA0EG,KAAK;AAC9E,OAAMC,SAAS,gBAAO;AACrBE,WAAS,CACR;AACCC,WAAQ,EADT;AAECC,aAAU;AAFX,GADQ;AADY,EAAP,CAAf;;AASAL,GAAEM,IAAF,CAAOL,OAAOM,QAAP,CAAgB,wBAAhB,CAAP;AACA,CAXD;;AAaA,mBAAK,kDAAL,EAAyDP,KAAK;AAC7D,OAAMQ,cAAc,gBAAO;AAC1BL,WAAS,CACR;AACCC,WAAQ,CACP;AACCK,WAAO,CADR;AAECC,UAAM,YAFP;AAGCC,aAAS;AAHV,IADO;AADT,GADQ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,EAAqB,wBAArB,CAAP;AACA,CAhBD","file":"index.test.js","sourcesContent":["import test from 'ava';\nimport chalk from 'chalk';\nimport {includes} from 'lodash';\nimport format, {formatResult} from '.';\n\nconst ok = chalk.bold(\n\t`${chalk.green(\n\t\t'✔'\n\t)} found 0 problems, 0 warnings \\n (Need help? -> https://github.com/conventional-changelog/commitlint#what-is-commitlint )\\n\\n`\n);\n\ntest('does nothing without arguments', t => {\n\tconst actual = format();\n\tt.deepEqual(actual, ok);\n});\n\ntest('does nothing without report results', t => {\n\tconst actual = format({results: []});\n\tt.deepEqual(actual, ok);\n});\n\ntest('does nothing without .errors and .warnings', t => {\n\tconst actual = format({results: [{}]});\n\tt.deepEqual(actual, ok);\n});\n\ntest('returns empty summary of problems for empty .errors and .warnings', t => {\n\tconst actual = format({\n\t\tresults: [\n\t\t\t{\n\t\t\t\terrors: [],\n\t\t\t\twarnings: []\n\t\t\t}\n\t\t]\n\t});\n\n\tt.true(actual.includes('0 problems, 0 warnings'));\n});\n\ntest('returns a correct of empty .errors and .warnings', t => {\n\tconst actualError = format({\n\t\tresults: [\n\t\t\t{\n\t\t\t\terrors: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlevel: 2,\n\t\t\t\t\t\tname: 'error-name',\n\t\t\t\t\t\tmessage: 'There was an error'\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t});\n\n\tconst actualWarning = format({\n\t\tresults: [\n\t\t\t{\n\t\t\t\twarnings: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlevel: 1,\n\t\t\t\t\t\tname: 'warning-name',\n\t\t\t\t\t\tmessage: 'There was a problem'\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t});\n\n\tt.true(includes(actualError, 'There was an error'));\n\tt.true(includes(actualError, '1 problems, 0 warnings'));\n\tt.true(includes(actualWarning, 'There was a problem'));\n\tt.true(includes(actualWarning, '0 problems, 1 warnings'));\n});\n\ntest('uses appropriate signs by default', t => {\n\tconst actualError = format({\n\t\tresults: [\n\t\t\t{\n\t\t\t\terrors: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlevel: 2,\n\t\t\t\t\t\tname: 'error-name',\n\t\t\t\t\t\tmessage: 'There was an error'\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t});\n\n\tconst actualWarning = format({\n\t\tresults: [\n\t\t\t{\n\t\t\t\twarnings: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlevel: 1,\n\t\t\t\t\t\tname: 'warning-name',\n\t\t\t\t\t\tmessage: 'There was a problem'\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t});\n\n\tt.true(includes(actualError, '✖'));\n\tt.true(includes(actualWarning, '⚠'));\n});\n\ntest('uses signs as configured', t => {\n\tconst options = {signs: ['HNT', 'WRN', 'ERR']};\n\tconst actualError = format(\n\t\t{\n\t\t\tresults: [\n\t\t\t\t{\n\t\t\t\t\terrors: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlevel: 2,\n\t\t\t\t\t\t\tname: 'error-name',\n\t\t\t\t\t\t\tmessage: 'There was an error'\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\toptions\n\t);\n\n\tconst actualWarning = format(\n\t\t{\n\t\t\tresults: [\n\t\t\t\t{\n\t\t\t\t\twarnings: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlevel: 1,\n\t\t\t\t\t\t\tname: 'warning-name',\n\t\t\t\t\t\t\tmessage: 'There was a problem'\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\toptions\n\t);\n\n\tt.true(includes(actualError, 'ERR'));\n\tt.true(includes(actualWarning, 'WRN'));\n});\n\ntest('format result provides summary without arguments', t => {\n\tconst actual = formatResult();\n\tconst actualText = actual.join('\\n');\n\n\tt.true(includes(actualText, '0 problems, 0 warnings'));\n});\n\ntest('format result transforms error to text', t => {\n\tconst actual = formatResult({\n\t\terrors: [\n\t\t\t{\n\t\t\t\tlevel: 2,\n\t\t\t\tname: 'error-name',\n\t\t\t\tmessage: 'There was an error'\n\t\t\t}\n\t\t]\n\t});\n\n\tconst actualText = actual.join('\\n');\n\n\tt.true(includes(actualText, 'error-name'));\n\tt.true(includes(actualText, 'There was an error'));\n\tt.true(includes(actualText, '1 problems, 0 warnings'));\n});\n\ntest('format result transforms warning to text', t => {\n\tconst actual = formatResult({\n\t\twarnings: [\n\t\t\t{\n\t\t\t\tlevel: 1,\n\t\t\t\tname: 'warning-name',\n\t\t\t\tmessage: 'There was a warning'\n\t\t\t}\n\t\t]\n\t});\n\n\tconst actualText = actual.join('\\n');\n\n\tt.true(includes(actualText, 'warning-name'));\n\tt.true(includes(actualText, 'There was a warning'));\n\tt.true(includes(actualText, '0 problems, 1 warnings'));\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/format",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.1",
|
|
4
4
|
"description": "Format commitlint reports",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -8,10 +8,8 @@
|
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
|
|
11
|
-
"clean": "npx rimraf lib",
|
|
12
11
|
"deps": "dep-check",
|
|
13
12
|
"pkg": "pkg-check --skip-import",
|
|
14
|
-
"lint": "xo",
|
|
15
13
|
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
|
|
16
14
|
"test": "ava -c 4 --verbose",
|
|
17
15
|
"watch": "babel src --out-dir lib --watch --source-maps"
|
|
@@ -35,18 +33,17 @@
|
|
|
35
33
|
"babel-preset-commitlint"
|
|
36
34
|
]
|
|
37
35
|
},
|
|
38
|
-
"xo": false,
|
|
39
36
|
"engines": {
|
|
40
37
|
"node": ">=4"
|
|
41
38
|
},
|
|
42
39
|
"repository": {
|
|
43
40
|
"type": "git",
|
|
44
|
-
"url": "https://github.com/
|
|
41
|
+
"url": "https://github.com/conventional-changelog/commitlint.git"
|
|
45
42
|
},
|
|
46
43
|
"bugs": {
|
|
47
|
-
"url": "https://github.com/
|
|
44
|
+
"url": "https://github.com/conventional-changelog/commitlint/issues"
|
|
48
45
|
},
|
|
49
|
-
"homepage": "https://github.com/
|
|
46
|
+
"homepage": "https://github.com/conventional-changelog/commitlint#readme",
|
|
50
47
|
"keywords": [
|
|
51
48
|
"conventional-changelog",
|
|
52
49
|
"commitlint",
|
|
@@ -59,20 +56,19 @@
|
|
|
59
56
|
},
|
|
60
57
|
"license": "MIT",
|
|
61
58
|
"devDependencies": {
|
|
62
|
-
"@commitlint/test": "^7.
|
|
63
|
-
"@commitlint/utils": "^7.
|
|
59
|
+
"@commitlint/test": "^7.6.0",
|
|
60
|
+
"@commitlint/utils": "^7.6.0",
|
|
64
61
|
"ava": "0.22.0",
|
|
65
62
|
"babel-cli": "6.26.0",
|
|
66
|
-
"babel-preset-commitlint": "^7.
|
|
63
|
+
"babel-preset-commitlint": "^7.6.0",
|
|
67
64
|
"babel-register": "6.26.0",
|
|
68
65
|
"concurrently": "3.5.1",
|
|
69
66
|
"cross-env": "5.1.1",
|
|
70
|
-
"lodash": "4.17.11"
|
|
71
|
-
"rimraf": "2.6.1",
|
|
72
|
-
"xo": "0.20.3"
|
|
67
|
+
"lodash": "4.17.11"
|
|
73
68
|
},
|
|
74
69
|
"dependencies": {
|
|
75
70
|
"babel-runtime": "^6.23.0",
|
|
76
71
|
"chalk": "^2.0.1"
|
|
77
|
-
}
|
|
72
|
+
},
|
|
73
|
+
"gitHead": "dc5619dea62b7b8ac72dc7758d70b684e010557b"
|
|
78
74
|
}
|