diff --git a/.gitignore b/.gitignore index 3c3629e..f846c68 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ node_modules +package-lock.json +yarn.lock diff --git a/index.js b/index.js index 1906915..21778ae 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict'; const dargs = require('dargs'); const execa = require('execa'); -const gutil = require('gulp-util'); +const PluginError = require('plugin-error'); const through = require('through2'); // TODO: Use execa localDir option when available const npmRunPath = require('npm-run-path'); @@ -43,7 +43,7 @@ module.exports = opts => { function aggregate(file, encoding, done) { if (file.isStream()) { - done(new gutil.PluginError('gulp-mocha', 'Streaming not supported')); + done(new PluginError('gulp-mocha', 'Streaming not supported')); return; } @@ -64,7 +64,7 @@ module.exports = opts => { done(); }) .catch(err => { - this.emit('error', new gutil.PluginError('gulp-mocha', err)); + this.emit('error', new PluginError('gulp-mocha', err)); done(); }); diff --git a/package.json b/package.json index 95b6d11..9b8f1b4 100644 --- a/package.json +++ b/package.json @@ -36,15 +36,16 @@ "dependencies": { "dargs": "^5.1.0", "execa": "^0.6.0", - "gulp-util": "^3.0.0", "mocha": "^3.0.0", "npm-run-path": "^2.0.2", + "plugin-error": "^0.1.2", "through2": "^2.0.3" }, "devDependencies": { "ava": "*", "gulp": "^3.9.1", "p-event": "^1.0.0", + "vinyl": "^2.1.0", "xo": "*" } } diff --git a/test/test.js b/test/test.js index a35ba8a..8589844 100644 --- a/test/test.js +++ b/test/test.js @@ -1,14 +1,14 @@ import fs from 'fs'; import path from 'path'; import test from 'ava'; -import gutil from 'gulp-util'; +import Vinyl from 'vinyl'; import pEvent from 'p-event'; import mocha from '..'; function fixture(name) { const fileName = path.join(__dirname, 'fixtures', name); - return new gutil.File({ + return new Vinyl({ path: fileName, contents: fs.existsSync(fileName) ? fs.readFileSync(fileName) : null }); @@ -33,9 +33,7 @@ test('pass async AssertionError to mocha', async t => { const event = pEvent(stream, 'error'); stream.end(fixture('fixture-async.js')); const error = await event; - const throws = /throws after timeout/.test(error.stdout); - const uncaught = /Uncaught AssertionError: false == true/.test(error.stdout); - t.true(throws || uncaught); + t.regex(error.stdout, /throws after timeout|Uncaught AssertionError.*: false == true/); }); test('require two files', async t => {