New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-mocha

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-mocha - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

37

index.js
'use strict';
var path = require('path');
var through = require('through');
var Duplex = require('stream').Duplex;
var gutil = require('gulp-util');

@@ -8,21 +8,36 @@ var Mocha = require('mocha');

module.exports = function (options) {
var mocha = new Mocha(options);
var duplex = new Duplex({objectMode: true});
var errorCount = 0;
return through(function (file) {
duplex._write = function (file, encoding, done) {
var mocha = new Mocha(options);
delete require.cache[require.resolve(path.resolve(file.path))];
mocha.addFile(file.path);
this.emit('data', file);
}, function () {
try {
mocha.run(function (errCount) {
if (errCount > 0) {
return this.emit('error', new Error('gulp-mocha: ' + errCount + ' ' + (errCount === 1 ? 'test' : 'tests') + ' failed.'));
}
this.emit('end');
duplex.push(file);
errorCount += errCount;
done();
}.bind(this));
} catch (err) {
this.emit('error', new Error('gulp-mocha: ' + err));
this.emit('error', err);
done();
}
};
duplex.on('finish', function () {
if (errorCount === 0) {
return;
}
var ec = errorCount;
errorCount = 0;
duplex.emit('error', new gutil.PluginError('gulp-mocha', [ec, (ec === 1 ? 'test' : 'tests'), 'failed.'].join(' ')));
});
duplex._read = function () {};
return duplex;
};
{
"name": "gulp-mocha",
"version": "0.2.0",
"version": "0.3.0",
"description": "Run Mocha tests",

@@ -37,5 +37,4 @@ "license": "MIT",

"gulp-util": "~2.2.0",
"through": "~2.3.0",
"mocha": "~1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc