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

Commit

Permalink
Require Node.js 6
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Dec 15, 2018
1 parent 0390c30 commit 030b52d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 31 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '10'
- '8'
- '6'
- '4'
22 changes: 9 additions & 13 deletions index.js
Expand Up @@ -6,12 +6,11 @@ const resolveCwd = require('resolve-cwd');
const execa = require('execa');

const BIN = require.resolve('ava/cli.js');
const HUNDRED_MEGABYTES = 1000 * 1000 * 100;

module.exports = opts => {
opts = Object.assign({
module.exports = options => {
options = Object.assign({
silent: false
}, opts);
}, options);

const files = [];

Expand All @@ -30,9 +29,9 @@ module.exports = opts => {

cb(null, file);
}, cb => {
const args = [BIN].concat(files, '--color', dargs(opts, {excludes: ['nyc']}));
const args = [BIN].concat(files, '--color', dargs(options, {excludes: ['nyc']}));

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

if (!nycBin) {
Expand All @@ -43,20 +42,17 @@ module.exports = opts => {
args.unshift(nycBin);
}

const ps = execa(process.execPath, args, {
// TODO: Remove this when `execa` supports a `buffer: false` option
maxBuffer: HUNDRED_MEGABYTES
});
const ps = execa(process.execPath, args, {buffer: false});

if (!opts.silent) {
if (!options.silent) {
ps.stdout.pipe(process.stdout);
ps.stderr.pipe(process.stderr);
}

ps.then(() => {
cb();
}).catch(err => {
cb(new gutil.PluginError('gulp-ava', err));
}).catch(error => {
cb(new gutil.PluginError('gulp-ava', error));
});
});
};
18 changes: 9 additions & 9 deletions package.json
Expand Up @@ -10,7 +10,7 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -33,19 +33,19 @@
"jasmine"
],
"dependencies": {
"ava": "^0.25.0",
"dargs": "^5.1.0",
"execa": "^0.10.0",
"gulp-util": "^3.0.6",
"ava": "^1.0.1",
"dargs": "^6.0.0",
"execa": "^1.0.0",
"gulp-util": "^3.0.8",
"resolve-cwd": "^2.0.0",
"through2": "^2.0.0"
"through2": "^3.0.0"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp": "^4.0.0",
"hooker": "^0.2.3",
"nyc": "^11.0.3",
"nyc": "^13.1.0",
"vinyl-file": "^3.0.0",
"xo": "*"
"xo": "^0.23.0"
},
"xo": {
"rules": {
Expand Down
12 changes: 6 additions & 6 deletions test.js
Expand Up @@ -2,21 +2,21 @@ import test from 'ava';
import vinylFile from 'vinyl-file';
import hooker from 'hooker';
import gutil from 'gulp-util';
import m from '.';
import ava from '.';

test.cb(t => {
const stream = m();
test.cb('main', t => {
const stream = ava();

hooker.hook(process.stderr, 'write', (...args) => {
hooker.hook(process.stdout, 'write', (...args) => {
if (/2.*passed/.test(args.join(' '))) {
hooker.unhook(gutil, 'log');
t.pass();
t.end();
}
});

stream.on('error', err => {
t.ifError(err);
stream.on('error', error => {
t.ifError(error);
t.end();
});

Expand Down

0 comments on commit 030b52d

Please sign in to comment.