@@ -32,20 +32,45 @@ test('should reprint input from stdin', async t => {
32
32
t . true ( actual . stdout . includes ( 'foo: bar' ) ) ;
33
33
} ) ;
34
34
35
- test ( 'should produce no success output with --quiet flag' , async t => {
35
+ test ( 'should produce success output with --verbose flag' , async t => {
36
+ const cwd = await git . bootstrap ( 'fixtures/default' ) ;
37
+ const actual = await cli ( [ '--verbose' ] , { cwd} ) ( 'type: bar' ) ;
38
+ t . true ( actual . stdout . includes ( '0 problems, 0 warnings' ) ) ;
39
+ t . is ( actual . stderr , '' ) ;
40
+ } ) ;
41
+
42
+ test ( 'should produce no output with --quiet flag' , async t => {
36
43
const cwd = await git . bootstrap ( 'fixtures/default' ) ;
37
44
const actual = await cli ( [ '--quiet' ] , { cwd} ) ( 'foo: bar' ) ;
38
45
t . is ( actual . stdout , '' ) ;
39
46
t . is ( actual . stderr , '' ) ;
40
47
} ) ;
41
48
42
- test ( 'should produce no success output with -q flag' , async t => {
49
+ test ( 'should produce no output with -q flag' , async t => {
43
50
const cwd = await git . bootstrap ( 'fixtures/default' ) ;
44
51
const actual = await cli ( [ '-q' ] , { cwd} ) ( 'foo: bar' ) ;
45
52
t . is ( actual . stdout , '' ) ;
46
53
t . is ( actual . stderr , '' ) ;
47
54
} ) ;
48
55
56
+ test ( 'should produce help for empty config' , async t => {
57
+ const cwd = await git . bootstrap ( 'fixtures/empty' ) ;
58
+ const actual = await cli ( [ ] , { cwd} ) ( 'foo: bar' ) ;
59
+ t . true ( actual . stdout . includes ( 'Please add rules' ) ) ;
60
+ t . is ( actual . code , 1 ) ;
61
+ } ) ;
62
+
63
+ test ( 'should produce help for problems' , async t => {
64
+ const cwd = await git . bootstrap ( 'fixtures/default' ) ;
65
+ const actual = await cli ( [ ] , { cwd} ) ( 'foo: bar' ) ;
66
+ t . true (
67
+ actual . stdout . includes (
68
+ 'Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
69
+ )
70
+ ) ;
71
+ t . is ( actual . code , 1 ) ;
72
+ } ) ;
73
+
49
74
test ( 'should fail for input from stdin without rules' , async t => {
50
75
const cwd = await git . bootstrap ( 'fixtures/empty' ) ;
51
76
const actual = await cli ( [ ] , { cwd} ) ( 'foo: bar' ) ;
@@ -259,13 +284,13 @@ test('should print full commit message when input from stdin fails', async t =>
259
284
t . is ( actual . code , 1 ) ;
260
285
} ) ;
261
286
262
- test ( 'should not print full commit message when input succeeds' , async t => {
287
+ test ( 'should not print commit message fully or partially when input succeeds' , async t => {
263
288
const cwd = await git . bootstrap ( 'fixtures/default' ) ;
264
289
const message = 'type: bar\n\nFoo bar bizz buzz.\n\nCloses #123.' ;
265
290
const actual = await cli ( [ ] , { cwd} ) ( message ) ;
266
291
267
292
t . false ( actual . stdout . includes ( message ) ) ;
268
- t . true ( actual . stdout . includes ( message . split ( '\n' ) [ 0 ] ) ) ;
293
+ t . false ( actual . stdout . includes ( message . split ( '\n' ) [ 0 ] ) ) ;
269
294
t . is ( actual . code , 0 ) ;
270
295
} ) ;
271
296
0 commit comments