Skip to content

Commit

Permalink
fix(stream): close the driver when try to use stream mode
Browse files Browse the repository at this point in the history
  • Loading branch information
felixzapata committed Aug 14, 2016
1 parent edca701 commit ee1a6e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ module.exports = function (customOptions) {
cb(null, file);
return;
}

if (file.isStream()) {
driver.quit();
cb(new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
return;
}
Expand All @@ -70,10 +72,10 @@ module.exports = function (customOptions) {
cb();
});


} catch (err) {
this.emit('error', new gutil.PluginError(PLUGIN_NAME, err));
}

};
return through.obj(bufferContents, createResults);
};
9 changes: 9 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,13 @@ describe('gulp-axe-core', function() {
}));
});

it('should emit error on streamed file', function (done) {
gulp.src(fixtures('working.html'), { buffer: false })
.pipe(axeCore())
.on('error', function (err) {
assert.equal(err.message, 'Streaming not supported');
done();
});
});

});

0 comments on commit ee1a6e5

Please sign in to comment.