Skip to content
This repository was archived by the owner on Aug 8, 2020. It is now read-only.

Commit 6e8eba2

Browse files
committed
Require Node.js 8
1 parent f220065 commit 6e8eba2

File tree

5 files changed

+31
-35
lines changed

5 files changed

+31
-35
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules
22
yarn.lock
3-
package-lock.json
43
.nyc_output

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: node_js
22
node_js:
3+
- '12'
34
- '10'
45
- '8'
5-
- '6'

index.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,56 @@ const dargs = require('dargs');
55
const resolveCwd = require('resolve-cwd');
66
const execa = require('execa');
77

8-
const BIN = require.resolve('ava/cli.js');
8+
const BINARY = require.resolve('ava/cli.js');
99

1010
module.exports = options => {
11-
options = Object.assign({
12-
silent: false
13-
}, options);
11+
options = {
12+
silent: false,
13+
...options
14+
};
1415

1516
const files = [];
1617

17-
return through.obj((file, enc, cb) => {
18+
return through.obj((file, encoding, callback) => {
1819
if (file.isNull()) {
19-
cb(null, file);
20+
callback(null, file);
2021
return;
2122
}
2223

2324
if (file.isStream()) {
24-
cb(new PluginError('gulp-ava', 'Streaming not supported'));
25+
callback(new PluginError('gulp-ava', 'Streaming not supported'));
2526
return;
2627
}
2728

2829
files.push(file.path);
2930

30-
cb(null, file);
31-
}, cb => {
32-
const args = [BIN].concat(files, '--color', dargs(options, {excludes: ['nyc']}));
31+
callback(null, file);
32+
}, async callback => {
33+
const args = [BINARY].concat(files, '--color', dargs(options, {excludes: ['nyc']}));
3334

3435
if (options.nyc) {
3536
const nycBin = resolveCwd('nyc/bin/nyc.js');
3637

3738
if (!nycBin) {
38-
cb(new PluginError('gulp-ava', 'Couldn\'t find the `nyc` binary'));
39+
callback(new PluginError('gulp-ava', 'Couldn\'t find the `nyc` binary'));
3940
return;
4041
}
4142

4243
args.unshift(nycBin);
4344
}
4445

45-
const ps = execa(process.execPath, args, {buffer: false});
46+
const subprocess = execa(process.execPath, args, {buffer: false});
4647

4748
if (!options.silent) {
48-
ps.stdout.pipe(process.stdout);
49-
ps.stderr.pipe(process.stderr);
49+
subprocess.stdout.pipe(process.stdout);
50+
subprocess.stderr.pipe(process.stderr);
5051
}
5152

52-
ps.then(() => {
53-
cb();
54-
}).catch(() => {
55-
cb(new PluginError('gulp-ava', 'One or more tests failed'));
56-
});
53+
try {
54+
await subprocess;
55+
callback();
56+
} catch (error) {
57+
callback(new PluginError('gulp-ava', 'One or more tests failed'));
58+
}
5759
});
5860
};

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "sindresorhus.com"
1111
},
1212
"engines": {
13-
"node": ">=6"
13+
"node": ">=8"
1414
},
1515
"scripts": {
1616
"test": "xo && ava"
@@ -33,20 +33,20 @@
3333
"jasmine"
3434
],
3535
"dependencies": {
36-
"ava": "^1.0.1",
37-
"dargs": "^6.0.0",
38-
"execa": "^1.0.0",
36+
"ava": "^2.1.0",
37+
"dargs": "^7.0.0",
38+
"execa": "^2.0.3",
3939
"fancy-log": "^1.3.3",
4040
"plugin-error": "^1.0.1",
41-
"resolve-cwd": "^2.0.0",
41+
"resolve-cwd": "^3.0.0",
4242
"through2": "^3.0.0"
4343
},
4444
"devDependencies": {
4545
"gulp": "^4.0.0",
4646
"hooker": "^0.2.3",
47-
"nyc": "^13.1.0",
47+
"nyc": "^14.1.1",
4848
"vinyl-file": "^3.0.0",
49-
"xo": "^0.23.0"
49+
"xo": "^0.24.0"
5050
},
5151
"xo": {
5252
"rules": {

readme.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ const ava = require('gulp-ava');
1818

1919
gulp.task('default', () =>
2020
gulp.src('test.js')
21-
// `gulp-ava` needs filepaths, so you can't have any plugins before it
21+
// `gulp-ava` needs file paths, so you can't have any plugins before it
2222
.pipe(ava({verbose: true}))
2323
);
2424
```
2525

2626

2727
## API
2828

29-
### ava([options])
29+
### ava(options?)
3030

3131
This plugin adheres to AVA [options](https://github.com/avajs/ava#configuration) in package.json. You can also specify options in the plugin, as seen above, but prefer the package.json approach whenever possible.
3232

@@ -45,8 +45,3 @@ Type: `boolean`<br>
4545
Default: `false`
4646

4747
Run AVA with [`nyc`](https://github.com/istanbuljs/nyc). You must have `nyc` as a devDependency. `nyc` [options](https://github.com/istanbuljs/nyc#configuring-nyc) can be defined in package.json.
48-
49-
50-
## License
51-
52-
MIT © [Sindre Sorhus](https://sindresorhus.com)

0 commit comments

Comments
 (0)