From c6232cae7c188612386f195a043c5de5e2196adb Mon Sep 17 00:00:00 2001 From: "cosmin.onea" Date: Wed, 21 Oct 2015 23:12:21 +0100 Subject: [PATCH 1/2] callback invoked twice in case of invalid json returned --- lib/azure-scripty.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/azure-scripty.js b/lib/azure-scripty.js index 07abff1..d6c9e3b 100644 --- a/lib/azure-scripty.js +++ b/lib/azure-scripty.js @@ -142,6 +142,7 @@ exports.exec = function exec(cmd, callback) { catch(parsing_error) { callback(parsing_error,stdout); + return; } } callback(undefined,json); From 96c22a10107c79634ccbd2f8a8f5d9606ba93714 Mon Sep 17 00:00:00 2001 From: "cosmin.onea" Date: Wed, 21 Oct 2015 23:41:46 +0100 Subject: [PATCH 2/2] fixed unit tests --- test/azure-scripty.coffee | 2 +- test/mocha.opts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/azure-scripty.coffee b/test/azure-scripty.coffee index 28361d8..7b79b7a 100644 --- a/test/azure-scripty.coffee +++ b/test/azure-scripty.coffee @@ -15,7 +15,7 @@ scripty.exec = (cmd, callback) -> calls++; receivedCmds.push(cmd); if expectedCmds.length > 0 - cmd.should.include expectedCmds.pop() + cmd.should.containEql expectedCmds.pop() callback errors.pop(), results.pop() describe 'scripty', -> diff --git a/test/mocha.opts b/test/mocha.opts index 1010a16..2cc407e 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1,2 +1,2 @@ ---compilers coffee:coffee-script ---reporter spec \ No newline at end of file +--compilers mocha --compilers coffee:coffee-script/register +--reporter spec