From c78f759cd8a16843d1b87fbd09f31a2641a258c6 Mon Sep 17 00:00:00 2001 From: David Cheung Date: Fri, 12 Aug 2016 16:11:38 -0400 Subject: [PATCH 1/2] Update debug dependency and exec not inherit env - In older debug versions debug messages are sent to STDOUT which causes tests to fail - Child_process.exec to not inherit env-var in tests --- package.json | 2 +- test/lb-ng.test.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a7f04f7..28f679c 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "devDependencies": { "bluebird": "^1.2.1", "chai": "^1.9.1", - "debug": "^0.8.0", + "debug": "^2.2.0", "fs.extra": "^1.2.1", "jshint": "^2.5.0", "loopback": "^2.25.0", diff --git a/test/lb-ng.test.js b/test/lb-ng.test.js index 5f32cdf..f2d80b8 100644 --- a/test/lb-ng.test.js +++ b/test/lb-ng.test.js @@ -83,12 +83,15 @@ describe('lb-ng', function() { //-- Helpers -- function runLbNg() { + // empty object for env so it does not inherit env-vars from parent process + // this avoids debug messages affecting the stdout + var options = {env:{}}; var argv = [process.execPath, require.resolve('../bin/lb-ng')] .concat(Array.prototype.slice.call(arguments)) .map(JSON.stringify) .join(' '); debug('--EXECFILE[%s]--', argv); - return exec(argv) + return exec(argv, options) .then(function(args) { debug('--STDOUT--\n%s\n--STDERR--\n%s\n--END--', args[0], args[1]); return args; From a470861ae9ac75971f28d02014ed6033279c68d0 Mon Sep 17 00:00:00 2001 From: David Cheung Date: Mon, 15 Aug 2016 11:19:17 -0400 Subject: [PATCH 2/2] Increase mocha timeout to 5000ms --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28f679c..e22c727 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ }, "scripts": { "pretest": "jshint .", - "test": "mocha" + "test": "mocha --timeout 5000" }, "repository": { "type": "git",