gulp-mocha
Advanced tools
Comparing version 2.0.1 to 2.1.0
17
index.js
@@ -7,5 +7,8 @@ 'use strict'; | ||
module.exports = function (options) { | ||
var mocha = new Mocha(options); | ||
module.exports = function (opts) { | ||
opts = opts || {}; | ||
var mocha = new Mocha(opts); | ||
var cache = {}; | ||
var hasTests = false; | ||
@@ -24,3 +27,6 @@ for (var key in require.cache) { | ||
var hasTests = false; | ||
if (opts.require && opts.require.length) { | ||
opts.require.forEach(require); | ||
} | ||
return through(function (file) { | ||
@@ -40,3 +46,6 @@ mocha.addFile(file.path); | ||
clearCache(); | ||
stream.emit('error', new gutil.PluginError('gulp-mocha', err, {stack: err.stack, showStack: true})); | ||
stream.emit('error', new gutil.PluginError('gulp-mocha', err, { | ||
stack: err.stack, | ||
showStack: true | ||
})); | ||
} | ||
@@ -43,0 +52,0 @@ } |
{ | ||
"name": "gulp-mocha", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Run Mocha tests", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -23,2 +23,3 @@ # gulp-mocha [![Build Status](https://travis-ci.org/sindresorhus/gulp-mocha.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-mocha) | ||
return gulp.src('test.js', {read: false}) | ||
// gulp-mocha needs filepaths so you can't have any plugins before it | ||
.pipe(mocha({reporter: 'nyan'})); | ||
@@ -86,3 +87,9 @@ }); | ||
##### require | ||
Type: `array` | ||
Require custom modules before tests are run. | ||
## FAQ | ||
@@ -89,0 +96,0 @@ |
5619
60
120