From 3a7f8dc1beb921e00e953b27fc6b04cf242823a9 Mon Sep 17 00:00:00 2001 From: Christopher Hiller Date: Fri, 29 Sep 2017 22:27:38 -0700 Subject: [PATCH] enhance runMochaJSON() helper by returning the subprocess instance - this allows tests to manually kill a subprocess or interact with it - also fixed some bad jsdoc --- test/integration/helpers.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/integration/helpers.js b/test/integration/helpers.js index a22ce67c77..4f10921a3a 100644 --- a/test/integration/helpers.js +++ b/test/integration/helpers.js @@ -44,9 +44,9 @@ 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; @@ -54,7 +54,7 @@ module.exports = { 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 { @@ -134,6 +134,8 @@ function invokeMocha (args, fn) { code: code }); }); + + return mocha; } function resolveFixturePath (fixture) {