@@ -32,20 +32,45 @@ test('should reprint input from stdin', async t => {
3232t . true ( actual . stdout . includes ( 'foo: bar' ) ) ;
3333} ) ;
3434
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 => {
3643const cwd = await git . bootstrap ( 'fixtures/default' ) ;
3744const actual = await cli ( [ '--quiet' ] , { cwd} ) ( 'foo: bar' ) ;
3845t . is ( actual . stdout , '' ) ;
3946t . is ( actual . stderr , '' ) ;
4047} ) ;
4148
42- test ( 'should produce no success output with -q flag' , async t => {
49+ test ( 'should produce no output with -q flag' , async t => {
4350const cwd = await git . bootstrap ( 'fixtures/default' ) ;
4451const actual = await cli ( [ '-q' ] , { cwd} ) ( 'foo: bar' ) ;
4552t . is ( actual . stdout , '' ) ;
4653t . is ( actual . stderr , '' ) ;
4754} ) ;
4855
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+
4974test ( 'should fail for input from stdin without rules' , async t => {
5075const cwd = await git . bootstrap ( 'fixtures/empty' ) ;
5176const actual = await cli ( [ ] , { cwd} ) ( 'foo: bar' ) ;
@@ -259,13 +284,13 @@ test('should print full commit message when input from stdin fails', async t =>
259284t . is ( actual . code , 1 ) ;
260285} ) ;
261286
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 => {
263288const cwd = await git . bootstrap ( 'fixtures/default' ) ;
264289const message = 'type: bar\n\nFoo bar bizz buzz.\n\nCloses #123.' ;
265290const actual = await cli ( [ ] , { cwd} ) ( message ) ;
266291
267292t . 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 ] ) ) ;
269294t . is ( actual . code , 0 ) ;
270295} ) ;
271296
0 commit comments