Skip to content

Commit a1c36a3

Browse files
committed
chore: consolidate dev dependencies
1 parent 927b4f8 commit a1c36a3

File tree

6 files changed

+69
-60
lines changed

6 files changed

+69
-60
lines changed

@commitlint/core/package.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464
"devDependencies": {
6565
"@commitlint/utils": "^3.1.1",
6666
"ansi-styles": "3.1.0",
67-
"ava": "0.18.2",
68-
"babel-cli": "^6.18.0",
67+
"ava": "0.22.0",
68+
"babel-cli": "^6.26.0",
6969
"babel-preset-commitlint": "^3.2.0",
70-
"babel-register": "6.24.1",
70+
"babel-register": "^6.26.0",
7171
"cross-env": "^5.0.1",
7272
"denodeify": "1.2.1",
7373
"dependency-check": "2.7.0",
@@ -78,11 +78,10 @@
7878
"nyc": "10.3.2",
7979
"path-exists": "3.0.0",
8080
"resolve-from": "3.0.0",
81-
"sander": "^0.6.0",
82-
"rimraf": "2.6.1",
8381
"xo": "0.18.2"
8482
},
8583
"dependencies": {
84+
"@marionebl/sander": "^0.6.1",
8685
"babel-runtime": "^6.23.0",
8786
"chalk": "^2.0.1",
8887
"conventional-changelog-angular": "^1.3.3",
@@ -92,7 +91,6 @@
9291
"franc": "^2.0.0",
9392
"git-raw-commits": "^1.1.2",
9493
"lodash": "^4.17.4",
95-
"mz": "^2.6.0",
9694
"path-exists": "^3.0.0",
9795
"pos": "^0.4.2",
9896
"rc": "^1.1.7",

@commitlint/core/src/library/parse.test.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import importFrom from 'import-from';
22
import test from 'ava';
33
import parse from './parse';
44

5-
test('throws when called without params', t => {
6-
t.throws(parse(), /Expected a raw commit/);
5+
test('throws when called without params', async t => {
6+
const error = await t.throws(parse());
7+
t.is(error.message, 'Expected a raw commit');
78
});
89

9-
test('throws when called with empty message', t => {
10-
t.throws(parse(''), /Expected a raw commit/);
10+
test('throws when called with empty message', async t => {
11+
const error = await t.throws(parse());
12+
t.is(error.message, 'Expected a raw commit');
1113
});
1214

1315
test('returns object with raw message', async t => {
@@ -16,10 +18,10 @@ test('returns object with raw message', async t => {
1618
t.is(actual.raw, message);
1719
});
1820

19-
test('calls parser with message and passed options', t => {
21+
test('calls parser with message and passed options', async t => {
2022
const message = 'message';
2123

22-
parse(message, m => {
24+
await parse(message, m => {
2325
t.is(message, m);
2426
return {};
2527
});

@commitlint/core/src/lint.test.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import test from 'ava';
22
import lint from './lint';
33

4-
test('throws without params', t => {
5-
t.throws(lint());
4+
test('throws without params', async t => {
5+
const error = await t.throws(lint());
6+
t.is(error.message, 'Expected a raw commit');
67
});
78

8-
test('throws with empty message', t => {
9-
t.throws(lint(''));
9+
test('throws with empty message', async t => {
10+
const error = await t.throws(lint(''));
11+
t.is(error.message, 'Expected a raw commit');
1012
});
1113

1214
test('positive on stub message and no rule', async t => {

@commitlint/core/src/load.test.js

+39-31
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,22 @@ import crypto from 'crypto';
33
import path from 'path';
44
import test from 'ava';
55
import exists from 'path-exists';
6-
import rimraf from 'rimraf';
76
import execa from 'execa';
8-
import denodeify from 'denodeify';
9-
import * as sander from 'sander';
7+
import * as sander from '@marionebl/sander';
108

119
import load from './load';
1210

13-
const rm = denodeify(rimraf);
14-
1511
test.beforeEach(async t => {
16-
t.context.repos = [await initRepository()];
12+
t.context.repo = await initRepository();
1713
});
1814

1915
test.afterEach.always(async t => {
20-
try {
21-
await Promise.all(t.context.repos.map(async repo => cleanRepository(repo)));
22-
t.context.repos = [];
23-
} catch (err) {
24-
console.log({err});
25-
}
16+
await cleanRepository(t.context.repo);
2617
});
2718

2819
test.serial('extends-empty should have no rules', async t => {
29-
const [repo] = t.context.repos;
20+
const {repo} = t.context;
21+
3022
await sander
3123
.copydir(path.join(repo.previous, 'fixtures/extends-empty'))
3224
.to(repo.directory);
@@ -36,7 +28,8 @@ test.serial('extends-empty should have no rules', async t => {
3628
});
3729

3830
test.serial('uses seed as configured', async t => {
39-
const [repo] = t.context.repos;
31+
const {repo} = t.context;
32+
4033
await sander
4134
.copydir(path.join(repo.previous, 'fixtures/extends-empty'))
4235
.to(repo.directory);
@@ -46,14 +39,16 @@ test.serial('uses seed as configured', async t => {
4639
});
4740

4841
test.serial('uses seed with parserPreset', async t => {
49-
const [repo] = t.context.repos;
42+
const {repo} = t.context;
43+
5044
await sander
5145
.copydir(path.join(repo.previous, 'fixtures/parser-preset'))
5246
.to(repo.directory);
5347

5448
const {parserPreset: actual} = await load({
5549
parserPreset: './conventional-changelog-custom'
5650
});
51+
5752
t.is(actual.name, './conventional-changelog-custom');
5853
t.deepEqual(actual.opts, {
5954
parserOpts: {
@@ -63,16 +58,18 @@ test.serial('uses seed with parserPreset', async t => {
6358
});
6459

6560
test.serial('invalid extend should throw', async t => {
66-
const [repo] = t.context.repos;
61+
const {repo} = t.context;
62+
6763
await sander
6864
.copydir(path.join(repo.previous, 'fixtures/extends-invalid'))
6965
.to(repo.directory);
7066

71-
t.throws(load());
67+
await t.throws(load());
7268
});
7369

7470
test.serial('empty file should have no rules', async t => {
75-
const [repo] = t.context.repos;
71+
const {repo} = t.context;
72+
7673
await sander
7774
.copydir(path.join(repo.previous, 'fixtures/empty-object-file'))
7875
.to(repo.directory);
@@ -82,7 +79,8 @@ test.serial('empty file should have no rules', async t => {
8279
});
8380

8481
test.serial('empty file should extend nothing', async t => {
85-
const [repo] = t.context.repos;
82+
const {repo} = t.context;
83+
8684
await sander
8785
.copydir(path.join(repo.previous, 'fixtures/empty-file'))
8886
.to(repo.directory);
@@ -92,7 +90,8 @@ test.serial('empty file should extend nothing', async t => {
9290
});
9391

9492
test.serial('recursive extends', async t => {
95-
const [repo] = t.context.repos;
93+
const {repo} = t.context;
94+
9695
await sander
9796
.copydir(path.join(repo.previous, 'fixtures/recursive-extends'))
9897
.to(repo.directory);
@@ -109,7 +108,8 @@ test.serial('recursive extends', async t => {
109108
});
110109

111110
test.serial('recursive extends with json file', async t => {
112-
const [repo] = t.context.repos;
111+
const {repo} = t.context;
112+
113113
await sander
114114
.copydir(path.join(repo.previous, 'fixtures/recursive-extends-json'))
115115
.to(repo.directory);
@@ -126,7 +126,8 @@ test.serial('recursive extends with json file', async t => {
126126
});
127127

128128
test.serial('recursive extends with yaml file', async t => {
129-
const [repo] = t.context.repos;
129+
const {repo} = t.context;
130+
130131
await sander
131132
.copydir(path.join(repo.previous, 'fixtures/recursive-extends-yaml'))
132133
.to(repo.directory);
@@ -143,7 +144,8 @@ test.serial('recursive extends with yaml file', async t => {
143144
});
144145

145146
test.serial('recursive extends with js file', async t => {
146-
const [repo] = t.context.repos;
147+
const {repo} = t.context;
148+
147149
await sander
148150
.copydir(path.join(repo.previous, 'fixtures/recursive-extends-js'))
149151
.to(repo.directory);
@@ -160,7 +162,8 @@ test.serial('recursive extends with js file', async t => {
160162
});
161163

162164
test.serial('recursive extends with package.json file', async t => {
163-
const [repo] = t.context.repos;
165+
const {repo} = t.context;
166+
164167
await sander
165168
.copydir(path.join(repo.previous, 'fixtures/recursive-extends-package'))
166169
.to(repo.directory);
@@ -179,7 +182,7 @@ test.serial('recursive extends with package.json file', async t => {
179182
test.serial(
180183
'parser preset overwrites completely instead of merging',
181184
async t => {
182-
const [repo] = t.context.repos;
185+
const {repo} = t.context;
183186

184187
await sander
185188
.copydir(path.join(repo.previous, 'fixtures/parser-preset-override'))
@@ -198,11 +201,12 @@ test.serial(
198201
);
199202

200203
test.serial('recursive extends with parserPreset', async t => {
201-
const [repo] = t.context.repos;
204+
const {repo} = t.context;
202205

203206
await sander
204207
.copydir(path.join(repo.previous, 'fixtures/recursive-parser-preset'))
205208
.to(repo.directory);
209+
206210
await sander
207211
.copydir(path.join(repo.previous, 'node_modules'))
208212
.to(path.join('node_modules'));
@@ -218,7 +222,8 @@ test.serial('recursive extends with parserPreset', async t => {
218222
});
219223

220224
test.serial('ignores unknow keys', async t => {
221-
const [repo] = t.context.repos;
225+
const {repo} = t.context;
226+
222227
await sander
223228
.copydir(path.join(repo.previous, 'fixtures/trash-file'))
224229
.to(repo.directory);
@@ -234,7 +239,8 @@ test.serial('ignores unknow keys', async t => {
234239
});
235240

236241
test.serial('ignores unknow keys recursively', async t => {
237-
const [repo] = t.context.repos;
242+
const {repo} = t.context;
243+
238244
await sander
239245
.copydir(path.join(repo.previous, 'fixtures/trash-extend'))
240246
.to(repo.directory);
@@ -250,7 +256,8 @@ test.serial('ignores unknow keys recursively', async t => {
250256
});
251257

252258
test.serial('supports legacy .conventional-changelog-lintrc', async t => {
253-
const [repo] = t.context.repos;
259+
const {repo} = t.context;
260+
254261
await sander
255262
.copydir(path.join(repo.previous, 'fixtures/legacy'))
256263
.to(repo.directory);
@@ -267,7 +274,8 @@ test.serial('supports legacy .conventional-changelog-lintrc', async t => {
267274
test.serial(
268275
'commitlint.config.js overrides .conventional-changelog-lintrc',
269276
async t => {
270-
const [repo] = t.context.repos;
277+
const {repo} = t.context;
278+
271279
await sander
272280
.copydir(path.join(repo.previous, 'fixtures/overriden-legacy'))
273281
.to(repo.directory);
@@ -302,7 +310,7 @@ async function cleanRepository(repo) {
302310
}
303311

304312
if (await exists(repo.directory)) {
305-
await rm(repo.directory);
313+
await sander.rimraf(repo.directory);
306314
}
307315
}
308316

@commitlint/core/src/read.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'path';
22
import exists from 'path-exists';
33
import up from 'find-up';
44
import gitRawCommits from 'git-raw-commits';
5-
import {readFile} from 'mz/fs';
5+
import {readFile} from '@marionebl/sander';
66

77
export default getCommitMessages;
88

@commitlint/core/src/read.test.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ import crypto from 'crypto';
33
import {join} from 'path';
44

55
import test from 'ava';
6-
import denodeify from 'denodeify';
76
import execa from 'execa';
8-
import {mkdir, writeFile} from 'mz/fs';
97
import exists from 'path-exists';
10-
import rimraf from 'rimraf';
8+
import * as sander from '@marionebl/sander';
119

1210
import pkg from '../package';
1311
import read from './read';
1412

15-
const rm = denodeify(rimraf);
16-
1713
test.beforeEach(async t => {
1814
t.context.repos = [await initRepository()];
1915
});
@@ -28,7 +24,7 @@ test.afterEach.always(async t => {
2824
});
2925

3026
test.serial('get edit commit message from git root', async t => {
31-
await writeFile('alpha.txt', 'alpha');
27+
await sander.writeFile('alpha.txt', 'alpha');
3228
await execa('git', ['add', '.']);
3329
await execa('git', ['commit', '-m', 'alpha']);
3430
const expected = ['alpha\n\n'];
@@ -37,7 +33,7 @@ test.serial('get edit commit message from git root', async t => {
3733
});
3834

3935
test.serial('get history commit messages', async t => {
40-
await writeFile('alpha.txt', 'alpha');
36+
await sander.writeFile('alpha.txt', 'alpha');
4137
await execa('git', ['add', 'alpha.txt']);
4238
await execa('git', ['commit', '-m', 'alpha']);
4339
await execa('git', ['rm', 'alpha.txt']);
@@ -49,8 +45,8 @@ test.serial('get history commit messages', async t => {
4945
});
5046

5147
test.serial('get edit commit message from git subdirectory', async t => {
52-
await mkdir('beta');
53-
await writeFile('beta/beta.txt', 'beta');
48+
await sander.mkdir('beta');
49+
await sander.writeFile('beta/beta.txt', 'beta');
5450
process.chdir('beta');
5551
await execa('git', ['add', '.']);
5652
await execa('git', ['commit', '-m', 'beta']);
@@ -63,7 +59,7 @@ test.serial('get edit commit message from git subdirectory', async t => {
6359
test.serial('get history commit messages from shallow clone', async t => {
6460
const [repo] = t.context.repos;
6561

66-
await writeFile('alpha.txt', 'alpha');
62+
await sander.writeFile('alpha.txt', 'alpha');
6763
await execa('git', ['add', 'alpha.txt']);
6864
await execa('git', ['commit', '-m', 'alpha']);
6965

@@ -107,10 +103,13 @@ async function cleanRepository(repo) {
107103
}
108104

109105
if (await exists(repo.directory)) {
110-
await rm(repo.directory);
106+
await sander.rimraf(repo.directory);
111107
}
112108
}
113109

114110
function rand() {
115-
return crypto.randomBytes(Math.ceil(6)).toString('hex').slice(0, 12);
111+
return crypto
112+
.randomBytes(Math.ceil(6))
113+
.toString('hex')
114+
.slice(0, 12);
116115
}

0 commit comments

Comments
 (0)