@@ -21,34 +21,40 @@ const cli = (args, options) => {
21
21
} ;
22
22
23
23
test ( 'should throw when called without [input]' , async t => {
24
- const cwd = await git . bootstrap ( 'fixtures/empty ' ) ;
24
+ const cwd = await git . bootstrap ( 'fixtures/default ' ) ;
25
25
const actual = await cli ( [ ] , { cwd} ) ( ) ;
26
26
t . is ( actual . code , 1 ) ;
27
27
} ) ;
28
28
29
29
test ( 'should reprint input from stdin' , async t => {
30
- const cwd = await git . bootstrap ( 'fixtures/empty ' ) ;
30
+ const cwd = await git . bootstrap ( 'fixtures/default ' ) ;
31
31
const actual = await cli ( [ ] , { cwd} ) ( 'foo: bar' ) ;
32
32
t . true ( actual . stdout . includes ( 'foo: bar' ) ) ;
33
33
} ) ;
34
34
35
35
test ( 'should produce no success output with --quiet flag' , async t => {
36
- const cwd = await git . bootstrap ( 'fixtures/empty ' ) ;
36
+ const cwd = await git . bootstrap ( 'fixtures/default ' ) ;
37
37
const actual = await cli ( [ '--quiet' ] , { cwd} ) ( 'foo: bar' ) ;
38
38
t . is ( actual . stdout , '' ) ;
39
39
t . is ( actual . stderr , '' ) ;
40
40
} ) ;
41
41
42
42
test ( 'should produce no success output with -q flag' , async t => {
43
- const cwd = await git . bootstrap ( 'fixtures/empty ' ) ;
43
+ const cwd = await git . bootstrap ( 'fixtures/default ' ) ;
44
44
const actual = await cli ( [ '-q' ] , { cwd} ) ( 'foo: bar' ) ;
45
45
t . is ( actual . stdout , '' ) ;
46
46
t . is ( actual . stderr , '' ) ;
47
47
} ) ;
48
48
49
- test ( 'should succeed for input from stdin without rules' , async t => {
49
+ test ( 'should fail for input from stdin without rules' , async t => {
50
50
const cwd = await git . bootstrap ( 'fixtures/empty' ) ;
51
51
const actual = await cli ( [ ] , { cwd} ) ( 'foo: bar' ) ;
52
+ t . is ( actual . code , 1 ) ;
53
+ } ) ;
54
+
55
+ test ( 'should succeed for input from stdin with rules' , async t => {
56
+ const cwd = await git . bootstrap ( 'fixtures/default' ) ;
57
+ const actual = await cli ( [ ] , { cwd} ) ( 'type: bar' ) ;
52
58
t . is ( actual . code , 0 ) ;
53
59
} ) ;
54
60
@@ -118,14 +124,17 @@ test('should work with husky via commitlint -e $GIT_PARAMS', async () => {
118
124
await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
119
125
} ) ;
120
126
121
- test ( 'should work with husky via commitlint -e %GIT_PARAMS%' , async ( ) => {
122
- const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
123
- await writePkg ( { scripts : { commitmsg : `'${ bin } ' -e %GIT_PARAMS%` } } , { cwd} ) ;
127
+ test . failing (
128
+ 'should work with husky via commitlint -e %GIT_PARAMS%' ,
129
+ async ( ) => {
130
+ const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
131
+ await writePkg ( { scripts : { commitmsg : `'${ bin } ' -e %GIT_PARAMS%` } } , { cwd} ) ;
124
132
125
- await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
126
- await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
127
- await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
128
- } ) ;
133
+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
134
+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
135
+ await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
136
+ }
137
+ ) ;
129
138
130
139
test ( 'should work with husky via commitlint -e $HUSKY_GIT_PARAMS' , async ( ) => {
131
140
const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
@@ -152,7 +161,7 @@ test('should work with husky via commitlint -e %HUSKY_GIT_PARAMS%', async () =>
152
161
} ) ;
153
162
154
163
test ( 'should allow reading of environment variables for edit file, succeeding if valid' , async t => {
155
- const cwd = await git . bootstrap ( ) ;
164
+ const cwd = await git . bootstrap ( 'fixtures/simple' ) ;
156
165
await sander . writeFile ( cwd , 'commit-msg-file' , 'foo' ) ;
157
166
const actual = await cli ( [ '--env' , 'variable' ] , {
158
167
cwd,
@@ -254,8 +263,8 @@ test('should print full commit message when input from stdin fails', async t =>
254
263
} ) ;
255
264
256
265
test ( 'should not print full commit message when input succeeds' , async t => {
257
- const cwd = await git . bootstrap ( 'fixtures/empty ' ) ;
258
- const message = 'foo : bar\n\nFoo bar bizz buzz.\n\nCloses #123.' ;
266
+ const cwd = await git . bootstrap ( 'fixtures/default ' ) ;
267
+ const message = 'type : bar\n\nFoo bar bizz buzz.\n\nCloses #123.' ;
259
268
const actual = await cli ( [ ] , { cwd} ) ( message ) ;
260
269
261
270
t . false ( actual . stdout . includes ( message ) ) ;
0 commit comments