mocha.parallel
Advanced tools
Comparing version 0.15.0 to 0.15.1
@@ -222,4 +222,4 @@ var Promise = require('bluebird'); | ||
var start = Date.now(); | ||
return createWrapper(fn, spec.ctx)().then(function() { | ||
spec.duration = Date.now() - start; | ||
return createWrapper(fn, spec.ctx)().then(function(duration) { | ||
spec.duration = duration; | ||
}); | ||
@@ -287,3 +287,4 @@ }, | ||
* Returns a wrapper for a given runnable's fn, including specs or hooks. | ||
* Optionally binds the function handler to the passed context. | ||
* Optionally binds the function handler to the passed context. Resolves | ||
* with the duration of the fn. | ||
* | ||
@@ -297,5 +298,7 @@ * @param {function} fn | ||
return new Promise(function(resolve, reject) { | ||
var start = Date.now(); | ||
var cb = function(err) { | ||
if (err) return reject(err); | ||
resolve(); | ||
resolve(Date.now() - start); | ||
}; | ||
@@ -312,3 +315,5 @@ | ||
if (!fn.length || (res && res.then)) { | ||
resolve(res); | ||
Promise.resolve(res).then(function() { | ||
resolve(Date.now() - start); | ||
}); | ||
} | ||
@@ -315,0 +320,0 @@ }); |
{ | ||
"name": "mocha.parallel", | ||
"version": "0.15.0", | ||
"version": "0.15.1", | ||
"description": "Run async mocha specs in parallel", | ||
@@ -32,3 +32,6 @@ "main": "lib/parallel.js", | ||
"semaphore": "^1.0.5" | ||
}, | ||
"devDependencies": { | ||
"dirmap": "0.0.2" | ||
} | ||
} |
var exec = require('child_process').exec; | ||
var assert = require('assert'); | ||
var fixtures = require('./fixtures'); | ||
var path = require('path'); | ||
var dirmap = require('dirmap'); | ||
var fixtures = dirmap(path.resolve(__dirname, './fixtures'), true); | ||
var path = require('path'); | ||
@@ -270,2 +272,12 @@ describe('parallel', function() { | ||
}); | ||
it.only('correctly reports duration for synchronous tests', function(done) { | ||
run(fixtures.syncTime, function(err, stdout, stderr) { | ||
if (err) return done(err); | ||
assert(!stderr.length); | ||
assert.equal(stdout.indexOf('a ('), -1); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -272,0 +284,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
38481
1132
0
1