File tree 2 files changed +31
-2
lines changed
2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change
1
+ import path from 'path' ;
2
+ import { git } from '@commitlint/test' ;
3
+ import test from 'ava' ;
4
+ import execa from 'execa' ;
5
+ import stream from 'string-to-stream' ;
6
+
7
+ const bin = path . join ( __dirname , './cli.js' ) ;
8
+
9
+ const cli = ( args , options ) => {
10
+ return ( input = '' ) => {
11
+ const c = execa ( bin , args , {
12
+ capture : [ 'stdout' ] ,
13
+ cwd : options . cwd ,
14
+ env : options . env
15
+ } ) ;
16
+ stream ( input ) . pipe ( c . stdin ) ;
17
+ return c . catch ( err => err ) ;
18
+ } ;
19
+ } ;
20
+
21
+ test ( 'should print warning if stage is empty' , async t => {
22
+ const cwd = await git . bootstrap ( ) ;
23
+ const actual = await cli ( [ ] , { cwd} ) ( 'foo: bar' ) ;
24
+ t . true ( actual . stdout . includes ( 'Nothing to commit.' ) ) ;
25
+ } ) ;
Original file line number Diff line number Diff line change 13
13
"commit" : " $npm_package_bin_commit" ,
14
14
"deps" : " dep-check" ,
15
15
"pkg" : " pkg-check --skip-main" ,
16
- "lint" : " xo"
16
+ "lint" : " xo" ,
17
+ "test" : " ava -c 4 --verbose"
17
18
},
18
19
"xo" : false ,
19
20
"repository" : {
36
37
},
37
38
"dependencies" : {
38
39
"@commitlint/prompt" : " ^7.2.0" ,
40
+ "@commitlint/test" : " ^7.1.2" ,
41
+ "ava" : " ^0.25.0" ,
39
42
"execa" : " 0.9.0" ,
40
- "meow" : " 3.7.0"
43
+ "meow" : " 3.7.0" ,
44
+ "string-to-stream" : " ^1.1.1"
41
45
}
42
46
}
You can’t perform that action at this time.
0 commit comments