From ef2360baeeebd97cb00eceb422ff2d6e40b3addc Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sat, 7 Feb 2015 19:57:58 +0000 Subject: [PATCH 1/4] Add node 0.12 to Travis config --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 82148451c..cdfe6a1e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: node_js before_install: - npm install -g npm@~1.4.18 node_js: + - "0.12" - "0.10" script: - istanbul cover ./node_modules/.bin/grunt --report lcovonly && istanbul report text && ( cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true ) && rm -rf coverage From a7b68c18b5244aa5e1d67d030ac9304996684437 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sun, 5 Jul 2015 22:10:34 +0100 Subject: [PATCH 2/4] Bump fs-extra version to fix 0.12 support --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fdfd9cc2e..85444960e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "nopt": "3.0.2", "mqtt": "0.3.x", "ws": "0.7.2", - "fs-extra": "0.18.4", + "fs-extra": "0.21.0", "clone": "1.0.2", "mustache": "2.1.1", "cron":"1.0.9", From bac4beae03e63d3dc0c388c40b687a7bfd104a4a Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sun, 5 Jul 2015 22:40:24 +0100 Subject: [PATCH 3/4] Fix Function error parsing for node 0.12 format --- nodes/core/core/80-function.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/nodes/core/core/80-function.js b/nodes/core/core/80-function.js index ce5fdb20a..2f7cb63bd 100644 --- a/nodes/core/core/80-function.js +++ b/nodes/core/core/80-function.js @@ -106,15 +106,27 @@ module.exports = function(RED) { this.status({fill:"yellow",shape:"dot",text:""+converted}); } } catch(err) { - var errorMessage = err.toString(); + + var line = 0; + var errorMessage; var stack = err.stack.split(/\r?\n/); if (stack.length > 0) { - var m = /at undefined:(\d+):(\d+)$/.exec(stack[1]); - if (m) { - var line = Number(m[1])-1; - var cha = m[2]; - errorMessage += " (line "+line+", col "+cha+")"; + while(line < stack.length && stack[line].indexOf("ReferenceError") !== 0) { + line++; } + + if (line < stack.length) { + errorMessage = stack[line]; + var m = /:(\d+):(\d+)$/.exec(stack[line+1]); + if (m) { + var line = Number(m[1])-1; + var cha = m[2]; + errorMessage += " (line "+line+", col "+cha+")"; + } + } + } + if (!errorMessage) { + errorMessage = err.toString(); } this.error(errorMessage, msg); } From 39df80bf99f49f332faa62840e590d2e34990b15 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sun, 5 Jul 2015 23:02:10 +0100 Subject: [PATCH 4/4] Fix exec test to restart helper server before each test --- test/nodes/core/core/75-exec_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/nodes/core/core/75-exec_spec.js b/test/nodes/core/core/75-exec_spec.js index 709a64d61..a4704a44c 100644 --- a/test/nodes/core/core/75-exec_spec.js +++ b/test/nodes/core/core/75-exec_spec.js @@ -23,7 +23,7 @@ var child_process = require('child_process'); describe('exec node', function() { - before(function(done) { + beforeEach(function(done) { helper.startServer(done); });