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

mocha.parallel

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha.parallel - npm Package Compare versions

Comparing version 0.11.2 to 0.12.0

fixtures/disable.js

2

fixtures/index.js

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

'failure', 'assertionFailure', 'parentHooks', 'sync', 'contextSkip',
'contextTimeout'];
'contextTimeout', 'disable'];

@@ -10,0 +10,0 @@ fixtures.forEach(function(fixture) {

@@ -12,3 +12,5 @@ var Promise = require('bluebird');

* specified specs and suites. Runnable contexts are bound, so this.skip()
* and this.timeout() may be used from within a spec.
* and this.timeout() may be used from within a spec. parallel.disable()
* may be invoked to use mocha's default test behavior, and parallel.enable()
* will re-enable the module.
*

@@ -33,2 +35,10 @@ * @example

/**
* Whether or not to enable parallel. If false, specs will be ran using
* mocha's default suite behavior.
*
* @var {bool}
*/
var enabled = true;
/**
* Private function invoked by parallel.

@@ -41,2 +51,6 @@ *

function _parallel(name, fn, key) {
if (!enabled) {
return (key) ? describe[key](name, fn) : describe(name, fn);
}
var specs = [];

@@ -157,2 +171,16 @@ var hooks = {};

/**
* Re-enables parallel if previously disabled.
*/
parallel.enable = function() {
enabled = false;
}
/**
* Disables parallel, falling back to mocha's default test functionality.
*/
parallel.disable = function() {
enabled = false;
}
/**
* Patches the global it() function used by mocha, and returns a function that

@@ -159,0 +187,0 @@ * restores the original behavior when invoked.

{
"name": "mocha.parallel",
"version": "0.11.2",
"version": "0.12.0",
"description": "Run async mocha specs in parallel",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -32,3 +32,5 @@ # mocha.parallel

* specified specs and suites. Runnable contexts are bound, so this.skip()
* and this.timeout() may be used from within a spec.
* and this.timeout() may be used from within a spec. parallel.disable()
* may be invoked to use mocha's default test behavior, and parallel.enable()
* will re-enable the module.
*

@@ -35,0 +37,0 @@ * @example

@@ -228,2 +228,26 @@ var exec = require('child_process').exec;

});
it('supports parallel.disable() for disabling functionality', function(done) {
var cmd = './node_modules/.bin/mocha ' + fixtures.disable;
exec(cmd, function(err, stdout, stderr) {
if (err) return done(err);
assert(!stderr.length);
assert(stdout.indexOf('2 passing') !== -1);
assert(stdout.indexOf('disable') !== -1);
[
'✓ test1',
'✓ test2'
].forEach(function(line) {
assert(stdout.indexOf(line) !== -1);
});
// Specs should run in 1s
var timeStr = stdout.match(/passing \((\d+)s\)/)[1];
assert.equal(parseInt(timeStr, 10), 1);
done();
});
});
});

@@ -230,0 +254,0 @@

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