Skip to content

Commit

Permalink
enhance runMochaJSON() helper by returning the subprocess instance
Browse files Browse the repository at this point in the history
- this allows tests to manually kill a subprocess or interact with it
- also fixed some bad jsdoc
  • Loading branch information
boneskull committed Sep 30, 2017
1 parent 0690d1a commit 3a7f8dc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/integration/helpers.js
Expand Up @@ -44,17 +44,17 @@ module.exports = {
* Invokes the mocha binary for the given fixture using the JSON reporter,
* returning the parsed output, as well as exit code.
*
* @param {string} fixturePath
* @param {array} args
* @param {function} fn
* @param {string} fixturePath - Path from __dirname__
* @param {string[]} args - Array of args
* @param {Function} fn - Callback
*/
runMochaJSON: function (fixturePath, args, fn) {
var path;

path = resolveFixturePath(fixturePath);
args = args || [];

invokeMocha(args.concat(['--reporter', 'json', path]), function (err, res) {
return invokeMocha(args.concat(['--reporter', 'json', path]), function (err, res) {
if (err) return fn(err);

try {
Expand Down Expand Up @@ -134,6 +134,8 @@ function invokeMocha (args, fn) {
code: code
});
});

return mocha;
}

function resolveFixturePath (fixture) {
Expand Down

0 comments on commit 3a7f8dc

Please sign in to comment.