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
2
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 2.2.0 to 3.0.0

10

index.js
'use strict';
var domain = require('domain');
var domain = require('domain'); // eslint-disable-line no-restricted-modules
var gutil = require('gulp-util');

@@ -7,3 +7,3 @@ var through = require('through');

var plur = require('plur');
var resolveFrom = require('resolve-from');
var reqCwd = require('req-cwd');

@@ -16,3 +16,3 @@ module.exports = function (opts) {

for (var key in require.cache) {
for (var key in require.cache) { // eslint-disable-line guard-for-in
cache[key] = true;

@@ -31,3 +31,3 @@ }

opts.require.forEach(function (x) {
require(resolveFrom(process.cwd(), x));
reqCwd(x);
});

@@ -45,3 +45,3 @@ }

function handleException(err) {
if (err.name === 'AssertionError' && runner) {
if (runner) {
runner.uncaught(err);

@@ -48,0 +48,0 @@ } else {

{
"name": "gulp-mocha",
"version": "2.2.0",
"version": "3.0.0",
"description": "Run Mocha tests",

@@ -16,3 +16,3 @@ "license": "MIT",

"scripts": {
"test": "mocha"
"test": "xo && mocha"
},

@@ -38,8 +38,17 @@ "files": [

"gulp-util": "^3.0.0",
"mocha": "^2.0.1",
"mocha": "^3.0.0",
"plur": "^2.1.0",
"resolve-from": "^1.0.0",
"req-cwd": "^1.0.1",
"temp": "^0.8.3",
"through": "^2.3.4"
},
"devDependencies": {
"xo": "*"
},
"xo": {
"envs": [
"node",
"mocha"
]
}
}
# gulp-mocha [![Build Status](https://travis-ci.org/sindresorhus/gulp-mocha.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-mocha)
> Run [Mocha](https://github.com/mochajs/mocha/) tests
> Run [Mocha](https://github.com/mochajs/mocha) tests
*Keep in mind that this is just a thin wrapper around Mocha and your issue is most likely with Mocha.*
**[Maintainer needed](https://github.com/sindresorhus/gulp-mocha/issues/128)**
## Install

@@ -18,13 +20,15 @@

```js
var gulp = require('gulp');
var mocha = require('gulp-mocha');
const gulp = require('gulp');
const mocha = require('gulp-mocha');
gulp.task('default', function () {
return gulp.src('test.js', {read: false})
gulp.task('default', () =>
gulp.src('test.js', {read: false})
// gulp-mocha needs filepaths so you can't have any plugins before it
.pipe(mocha({reporter: 'nyan'}));
});
.pipe(mocha({reporter: 'nyan'}))
);
```
> If you are writing a watch task to run your tests as you modify your `.js` files, be aware that you might run into issues. This plugin runs your Mocha tests within the same process as your watch task and state isn't reset between runs. If your tests eventually fail within the watch task but pass when run in a standalone task or with `mocha test`, then you need to use the [`gulp-spawn-mocha`](https://github.com/KenPowers/gulp-spawn-mocha) plugin.
## API

@@ -38,21 +42,21 @@

Type: `string`
Default: `bdd`
Values: `bdd`, `tdd`, `qunit`, `exports`
Type: `string`<br>
Default: `bdd`<br>
Values: `bdd` `tdd` `qunit` `exports`
The interface to use.
Interface to use.
##### reporter
Type: `string`
Default: `spec` | `dot` prior to mocha v1.21.0
Values: [reporters](https://github.com/mochajs/mocha/tree/master/lib/reporters)
Type: `string`<br>
Default: `spec`
Values: [Reporters](https://github.com/mochajs/mocha/tree/master/lib/reporters)
The reporter that will be used.
Reporter that will be used.
This option can also be used to utilize third-party reporters. For example if you `npm install mocha-lcov-reporter` you can then do use `mocha-lcov-reporter` as value.
This option can also be used to utilize third-party reporters. For example, if you `npm install mocha-lcov-reporter` you can then do use `mocha-lcov-reporter` as value.
##### globals
Type: `array`
Type: `Array`

@@ -63,3 +67,3 @@ List of accepted global variable names, example `['YUI']`. Accepts wildcards to match multiple global variables, e.g. `['gulp*']` or even `['*']`. See [Mocha globals option](http://mochajs.org/#globals-option).

Type: `number`
Type: `number`<br>
Default: `2000`

@@ -71,3 +75,3 @@

Type: `boolean`
Type: `boolean`<br>
Default: `false`

@@ -79,3 +83,3 @@

Type: `boolean`
Type: `boolean`<br>
Default: `false`

@@ -93,3 +97,3 @@

Type: `array`
Type: `Array`

@@ -106,24 +110,21 @@ Require custom modules before tests are run.

```js
gulp.task('default', function () {
return gulp.src('test.js')
gulp.task('default', () =>
gulp.src('test.js')
.pipe(mocha())
.once('error', function () {
.once('error', () => {
process.exit(1);
})
.once('end', function () {
.once('end', () => {
process.exit();
});
});
})
);
```
### CoffeeScript
### Babel
Add `require('coffee-script/register')` to the top of your `gulpfile.js`.
Add `require('babel-core/register');` to the top of your `gulpfile.js`. Make sure to read the [Babel docs](https://babeljs.io/docs/usage/require/).
### Babel
Add `require('babel/register')` to the top of your `gulpfile.js`.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
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