From 16de704c3ec5f03ee7499cf365283f0a637d5ced Mon Sep 17 00:00:00 2001 From: Sebastian Kusnier Date: Sun, 4 Mar 2012 21:05:23 +0100 Subject: [PATCH 1/2] Filter stack line with regex /types.js:83:39/ - Without this filter the filename is wrong - This makes problems with the vim plugins: nodeunit.vim and vim-markgreen On unit test errors vim jumps to the types.js file --- lib/reporters/machineout.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/reporters/machineout.js b/lib/reporters/machineout.js index 8e611fe47..2774b7f6b 100644 --- a/lib/reporters/machineout.js +++ b/lib/reporters/machineout.js @@ -58,7 +58,10 @@ exports.run = function (files, options, callback) { if (delimiter === undefined) { delimiter = ':'; } - traceback = stack.split('\n'); + traceback = stack.split(/\n/).filter(function (line) { + // exclude line of "types.js" + return ! RegExp(/types.js:83:39/).test(line); + }); firstline = traceback.shift(); trace = parseTrace(traceback[0]); return {filename: trace.filename, row: trace.row, column: trace.column, message: firstline}; From 0a1b8036c32c3281c6821d35ca3ca2cc8a204a34 Mon Sep 17 00:00:00 2001 From: Sebastian Kusnier Date: Sun, 4 Mar 2012 23:25:05 +0100 Subject: [PATCH 2/2] Always filter types.js in stack trace --- lib/reporters/machineout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reporters/machineout.js b/lib/reporters/machineout.js index 2774b7f6b..d9a7c4d5d 100644 --- a/lib/reporters/machineout.js +++ b/lib/reporters/machineout.js @@ -60,7 +60,7 @@ exports.run = function (files, options, callback) { } traceback = stack.split(/\n/).filter(function (line) { // exclude line of "types.js" - return ! RegExp(/types.js:83:39/).test(line); + return ! RegExp(/nodeunit\/lib\/types.js:/).test(line); }); firstline = traceback.shift(); trace = parseTrace(traceback[0]);