1
+ import { git } from '@commitlint/test' ;
1
2
import test from 'ava' ;
2
3
3
- import { bootstrap } from './test-git' ;
4
4
import load from './load' ;
5
5
6
6
test ( 'extends-empty should have no rules' , async t => {
7
- const cwd = await bootstrap ( 'fixtures/extends-empty' ) ;
7
+ const cwd = await git . bootstrap ( 'fixtures/extends-empty' ) ;
8
8
const actual = await load ( { } , { cwd} ) ;
9
9
t . deepEqual ( actual . rules , { } ) ;
10
10
} ) ;
11
11
12
12
test ( 'uses seed as configured' , async t => {
13
- const cwd = await bootstrap ( 'fixtures/extends-empty' ) ;
13
+ const cwd = await git . bootstrap ( 'fixtures/extends-empty' ) ;
14
14
const actual = await load ( { rules : { foo : 'bar' } } , { cwd} ) ;
15
15
t . is ( actual . rules . foo , 'bar' ) ;
16
16
} ) ;
17
17
18
18
test ( 'uses seed with parserPreset' , async t => {
19
- const cwd = await bootstrap ( 'fixtures/parser-preset' ) ;
19
+ const cwd = await git . bootstrap ( 'fixtures/parser-preset' ) ;
20
20
const { parserPreset : actual } = await load (
21
21
{
22
22
parserPreset : './conventional-changelog-custom'
@@ -33,24 +33,24 @@ test('uses seed with parserPreset', async t => {
33
33
} ) ;
34
34
35
35
test ( 'invalid extend should throw' , async t => {
36
- const cwd = await bootstrap ( 'fixtures/extends-invalid' ) ;
36
+ const cwd = await git . bootstrap ( 'fixtures/extends-invalid' ) ;
37
37
await t . throws ( load ( { } , { cwd} ) ) ;
38
38
} ) ;
39
39
40
40
test ( 'empty file should have no rules' , async t => {
41
- const cwd = await bootstrap ( 'fixtures/empty-object-file' ) ;
41
+ const cwd = await git . bootstrap ( 'fixtures/empty-object-file' ) ;
42
42
const actual = await load ( { } , { cwd} ) ;
43
43
t . deepEqual ( actual . rules , { } ) ;
44
44
} ) ;
45
45
46
46
test ( 'empty file should extend nothing' , async t => {
47
- const cwd = await bootstrap ( 'fixtures/empty-file' ) ;
47
+ const cwd = await git . bootstrap ( 'fixtures/empty-file' ) ;
48
48
const actual = await load ( { } , { cwd} ) ;
49
49
t . deepEqual ( actual . extends , [ ] ) ;
50
50
} ) ;
51
51
52
52
test ( 'respects cwd option' , async t => {
53
- const cwd = await bootstrap ( 'fixtures/recursive-extends/first-extended' ) ;
53
+ const cwd = await git . bootstrap ( 'fixtures/recursive-extends/first-extended' ) ;
54
54
const actual = await load ( { } , { cwd} ) ;
55
55
t . deepEqual ( actual , {
56
56
extends : [ './second-extended' ] ,
@@ -62,7 +62,7 @@ test('respects cwd option', async t => {
62
62
} ) ;
63
63
64
64
test ( 'recursive extends' , async t => {
65
- const cwd = await bootstrap ( 'fixtures/recursive-extends' ) ;
65
+ const cwd = await git . bootstrap ( 'fixtures/recursive-extends' ) ;
66
66
const actual = await load ( { } , { cwd} ) ;
67
67
t . deepEqual ( actual , {
68
68
extends : [ './first-extended' ] ,
@@ -75,7 +75,7 @@ test('recursive extends', async t => {
75
75
} ) ;
76
76
77
77
test ( 'recursive extends with json file' , async t => {
78
- const cwd = await bootstrap ( 'fixtures/recursive-extends-json' ) ;
78
+ const cwd = await git . bootstrap ( 'fixtures/recursive-extends-json' ) ;
79
79
const actual = await load ( { } , { cwd} ) ;
80
80
81
81
t . deepEqual ( actual , {
@@ -89,7 +89,7 @@ test('recursive extends with json file', async t => {
89
89
} ) ;
90
90
91
91
test ( 'recursive extends with yaml file' , async t => {
92
- const cwd = await bootstrap ( 'fixtures/recursive-extends-yaml' ) ;
92
+ const cwd = await git . bootstrap ( 'fixtures/recursive-extends-yaml' ) ;
93
93
const actual = await load ( { } , { cwd} ) ;
94
94
95
95
t . deepEqual ( actual , {
@@ -103,7 +103,7 @@ test('recursive extends with yaml file', async t => {
103
103
} ) ;
104
104
105
105
test ( 'recursive extends with js file' , async t => {
106
- const cwd = await bootstrap ( 'fixtures/recursive-extends-js' ) ;
106
+ const cwd = await git . bootstrap ( 'fixtures/recursive-extends-js' ) ;
107
107
const actual = await load ( { } , { cwd} ) ;
108
108
109
109
t . deepEqual ( actual , {
@@ -117,7 +117,7 @@ test('recursive extends with js file', async t => {
117
117
} ) ;
118
118
119
119
test ( 'recursive extends with package.json file' , async t => {
120
- const cwd = await bootstrap ( 'fixtures/recursive-extends-package' ) ;
120
+ const cwd = await git . bootstrap ( 'fixtures/recursive-extends-package' ) ;
121
121
const actual = await load ( { } , { cwd} ) ;
122
122
123
123
t . deepEqual ( actual , {
@@ -131,7 +131,7 @@ test('recursive extends with package.json file', async t => {
131
131
} ) ;
132
132
133
133
test ( 'parser preset overwrites completely instead of merging' , async t => {
134
- const cwd = await bootstrap ( 'fixtures/parser-preset-override' ) ;
134
+ const cwd = await git . bootstrap ( 'fixtures/parser-preset-override' ) ;
135
135
const actual = await load ( { } , { cwd} ) ;
136
136
137
137
t . is ( actual . parserPreset . name , './custom' ) ;
@@ -145,7 +145,7 @@ test('parser preset overwrites completely instead of merging', async t => {
145
145
} ) ;
146
146
147
147
test ( 'recursive extends with parserPreset' , async t => {
148
- const cwd = await bootstrap ( 'fixtures/recursive-parser-preset' ) ;
148
+ const cwd = await git . bootstrap ( 'fixtures/recursive-parser-preset' ) ;
149
149
const actual = await load ( { } , { cwd} ) ;
150
150
151
151
t . is ( actual . parserPreset . name , './conventional-changelog-custom' ) ;
@@ -157,7 +157,7 @@ test('recursive extends with parserPreset', async t => {
157
157
} ) ;
158
158
159
159
test ( 'ignores unknow keys' , async t => {
160
- const cwd = await bootstrap ( 'fixtures/trash-file' ) ;
160
+ const cwd = await git . bootstrap ( 'fixtures/trash-file' ) ;
161
161
const actual = await load ( { } , { cwd} ) ;
162
162
163
163
t . deepEqual ( actual , {
@@ -170,7 +170,7 @@ test('ignores unknow keys', async t => {
170
170
} ) ;
171
171
172
172
test ( 'ignores unknow keys recursively' , async t => {
173
- const cwd = await bootstrap ( 'fixtures/trash-extend' ) ;
173
+ const cwd = await git . bootstrap ( 'fixtures/trash-extend' ) ;
174
174
const actual = await load ( { } , { cwd} ) ;
175
175
176
176
t . deepEqual ( actual , {
0 commit comments