From 030b52da008756b0ed6b05193e2c1421fb8ff756 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 15 Dec 2018 21:30:41 +0100 Subject: [PATCH] Require Node.js 6 --- .gitattributes | 3 +-- .travis.yml | 2 +- index.js | 22 +++++++++------------- package.json | 18 +++++++++--------- test.js | 12 ++++++------ 5 files changed, 26 insertions(+), 31 deletions(-) diff --git a/.gitattributes b/.gitattributes index 391f0a4..6313b56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ -* text=auto -*.js text eol=lf +* text=auto eol=lf diff --git a/.travis.yml b/.travis.yml index 7d69d74..2ae9d62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: + - '10' - '8' - '6' - - '4' diff --git a/index.js b/index.js index 1e54662..73597ca 100644 --- a/index.js +++ b/index.js @@ -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 = []; @@ -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) { @@ -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)); }); }); }; diff --git a/package.json b/package.json index 95080ab..ae2aa31 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "sindresorhus.com" }, "engines": { - "node": ">=4" + "node": ">=6" }, "scripts": { "test": "xo && ava" @@ -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": { diff --git a/test.js b/test.js index 4a873c3..faf4c3c 100644 --- a/test.js +++ b/test.js @@ -2,12 +2,12 @@ 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(); @@ -15,8 +15,8 @@ test.cb(t => { } }); - stream.on('error', err => { - t.ifError(err); + stream.on('error', error => { + t.ifError(error); t.end(); });