Skip to content

Commit

Permalink
Drop dependency on deprecated gulp-util (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
demurgos authored and sindresorhus committed Dec 30, 2017
1 parent 67b1e3e commit ac3d7fc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
package-lock.json
yarn.lock
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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;
}

Expand All @@ -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();
});

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*"
}
}
8 changes: 3 additions & 5 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -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
});
Expand All @@ -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 => {
Expand Down

0 comments on commit ac3d7fc

Please sign in to comment.