File tree 2 files changed +22
-2
lines changed
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,11 @@ const flags = {
56
56
type : 'boolean' ,
57
57
description : 'display this help message'
58
58
} ,
59
+ 'help-url' : {
60
+ alias : 'H' ,
61
+ type : 'string' ,
62
+ description : 'helpurl in error message'
63
+ } ,
59
64
from : {
60
65
alias : 'f' ,
61
66
default : null ,
@@ -220,8 +225,9 @@ async function main(options) {
220
225
const output = format ( report , {
221
226
color : flags . color ,
222
227
verbose : flags . verbose ,
223
- helpUrl :
224
- 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
228
+ helpUrl : flags . helpUrl
229
+ ? flags . helpUrl . trim ( )
230
+ : 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
225
231
} ) ;
226
232
227
233
if ( ! flags . quiet && output !== '' ) {
Original file line number Diff line number Diff line change @@ -71,6 +71,20 @@ test('should produce help for problems', async t => {
71
71
t . is ( actual . code , 1 ) ;
72
72
} ) ;
73
73
74
+ test ( 'should produce help for problems with correct helpurl' , async t => {
75
+ const cwd = await git . bootstrap ( 'fixtures/default' ) ;
76
+ const actual = await cli (
77
+ [ '-H https://github.com/conventional-changelog/commitlint/#testhelpurl' ] ,
78
+ { cwd}
79
+ ) ( 'foo: bar' ) ;
80
+ t . true (
81
+ actual . stdout . includes (
82
+ 'Get help: https://github.com/conventional-changelog/commitlint/#testhelpurl'
83
+ )
84
+ ) ;
85
+ t . is ( actual . code , 1 ) ;
86
+ } ) ;
87
+
74
88
test ( 'should fail for input from stdin without rules' , async t => {
75
89
const cwd = await git . bootstrap ( 'fixtures/empty' ) ;
76
90
const actual = await cli ( [ ] , { cwd} ) ( 'foo: bar' ) ;
You can’t perform that action at this time.
0 commit comments