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

Commit e1d5ecf

Browse files
committed
also emit error event when there's no stderr
fixes #12
1 parent 72e99d3 commit e1d5ecf

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed
File renamed without changes.

fixture3.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import test from 'ava';
2+
3+
test('bar', t => {
4+
t.fail();
5+
});

gulpfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
var gulp = require('gulp');
3+
var ava = require('./');
4+
5+
gulp.task('default', function () {
6+
return gulp.src('fixture*.js')
7+
.pipe(ava());
8+
});

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
var childProcess = require('child_process');
33
var gutil = require('gulp-util');
44
var through = require('through2');
5+
56
var BIN = require.resolve('ava/cli.js');
67

78
module.exports = function () {
@@ -26,7 +27,7 @@ module.exports = function () {
2627

2728
childProcess.execFile(process.execPath, files.concat('--color'), function (err, stdout, stderr) {
2829
if (err) {
29-
this.emit('error', new gutil.PluginError('gulp-ava', stderr));
30+
this.emit('error', new gutil.PluginError('gulp-ava', stderr || stdout || err));
3031
return;
3132
}
3233

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@
3838
"through2": "^2.0.0"
3939
},
4040
"devDependencies": {
41+
"gulp": "^3.9.1",
4142
"hooker": "^0.2.3",
4243
"vinyl-file": "^2.0.0",
4344
"xo": "*"
45+
},
46+
"xo": {
47+
"rules": {
48+
"ava/no-ignored-test-files": "off"
49+
}
4450
}
4551
}

test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ test.cb(t => {
1515
}
1616
});
1717

18-
stream.on('error', err => t.ifError(err));
18+
stream.on('error', err => {
19+
t.ifError(err);
20+
t.end();
21+
});
1922
stream.write(vinylFile.readSync('fixture.js'));
20-
stream.write(vinylFile.readSync('fixture-2.js'));
23+
stream.write(vinylFile.readSync('fixture2.js'));
2124
stream.end();
2225
});

0 commit comments

Comments
 (0)