@@ -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
@@ -152,7 +158,7 @@ test('should work with husky via commitlint -e %HUSKY_GIT_PARAMS%', async () =>
152
158
} ) ;
153
159
154
160
test ( 'should allow reading of environment variables for edit file, succeeding if valid' , async t => {
155
- const cwd = await git . bootstrap ( ) ;
161
+ const cwd = await git . bootstrap ( 'fixtures/simple' ) ;
156
162
await sander . writeFile ( cwd , 'commit-msg-file' , 'foo' ) ;
157
163
const actual = await cli ( [ '--env' , 'variable' ] , {
158
164
cwd,
@@ -254,8 +260,8 @@ test('should print full commit message when input from stdin fails', async t =>
254
260
} ) ;
255
261
256
262
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.' ;
263
+ const cwd = await git . bootstrap ( 'fixtures/default ' ) ;
264
+ const message = 'type : bar\n\nFoo bar bizz buzz.\n\nCloses #123.' ;
259
265
const actual = await cli ( [ ] , { cwd} ) ( message ) ;
260
266
261
267
t . false ( actual . stdout . includes ( message ) ) ;
0 commit comments