Skip to content

Commit ac3d7fc

Browse files
demurgossindresorhus
authored andcommitted
Drop dependency on deprecated gulp-util (#187)
1 parent 67b1e3e commit ac3d7fc

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
package-lock.json
3+
yarn.lock

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
const dargs = require('dargs');
33
const execa = require('execa');
4-
const gutil = require('gulp-util');
4+
const PluginError = require('plugin-error');
55
const through = require('through2');
66
// TODO: Use execa localDir option when available
77
const npmRunPath = require('npm-run-path');
@@ -43,7 +43,7 @@ module.exports = opts => {
4343

4444
function aggregate(file, encoding, done) {
4545
if (file.isStream()) {
46-
done(new gutil.PluginError('gulp-mocha', 'Streaming not supported'));
46+
done(new PluginError('gulp-mocha', 'Streaming not supported'));
4747
return;
4848
}
4949

@@ -64,7 +64,7 @@ module.exports = opts => {
6464
done();
6565
})
6666
.catch(err => {
67-
this.emit('error', new gutil.PluginError('gulp-mocha', err));
67+
this.emit('error', new PluginError('gulp-mocha', err));
6868
done();
6969
});
7070

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@
3636
"dependencies": {
3737
"dargs": "^5.1.0",
3838
"execa": "^0.6.0",
39-
"gulp-util": "^3.0.0",
4039
"mocha": "^3.0.0",
4140
"npm-run-path": "^2.0.2",
41+
"plugin-error": "^0.1.2",
4242
"through2": "^2.0.3"
4343
},
4444
"devDependencies": {
4545
"ava": "*",
4646
"gulp": "^3.9.1",
4747
"p-event": "^1.0.0",
48+
"vinyl": "^2.1.0",
4849
"xo": "*"
4950
}
5051
}

test/test.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import fs from 'fs';
22
import path from 'path';
33
import test from 'ava';
4-
import gutil from 'gulp-util';
4+
import Vinyl from 'vinyl';
55
import pEvent from 'p-event';
66
import mocha from '..';
77

88
function fixture(name) {
99
const fileName = path.join(__dirname, 'fixtures', name);
1010

11-
return new gutil.File({
11+
return new Vinyl({
1212
path: fileName,
1313
contents: fs.existsSync(fileName) ? fs.readFileSync(fileName) : null
1414
});
@@ -33,9 +33,7 @@ test('pass async AssertionError to mocha', async t => {
3333
const event = pEvent(stream, 'error');
3434
stream.end(fixture('fixture-async.js'));
3535
const error = await event;
36-
const throws = /throws after timeout/.test(error.stdout);
37-
const uncaught = /Uncaught AssertionError: false == true/.test(error.stdout);
38-
t.true(throws || uncaught);
36+
t.regex(error.stdout, /throws after timeout|Uncaught AssertionError.*: false == true/);
3937
});
4038

4139
test('require two files', async t => {

0 commit comments

Comments
 (0)