Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

enhance runMochaJSON() helper by returning the subprocess instance

Christopher Hiller3a7f8dc1beb9
diff --git a/test/integration/helpers.js b/test/integration/helpers.js
index a22ce67c..4f10921a 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) {