From ed9fa3a599fd6818038c20091bc98b82d0db1886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Sun, 20 Mar 2011 23:10:23 +0100 Subject: [PATCH] Remove main stack trace from default reporter (closes #23) I've come to the understanding that mot of the stack trace are irrelevant, thus this commit will remove all of it except the file and line number of the second entry in the stack trace which empirically matches the probable invocation in the test code --- lib/reporters/default.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/reporters/default.js b/lib/reporters/default.js index 683b66ded..75977274b 100644 --- a/lib/reporters/default.js +++ b/lib/reporters/default.js @@ -22,6 +22,11 @@ var nodeunit = require('../nodeunit'), exports.info = "Default tests reporter"; +Error.prepareStackTrace = function(error, structuredStackTrace) { + // our invocation will be at the second level of the stack trace + var our = structuredStackTrace[1]; + return "\nat " + our.getFileName() + " line " + our.getLineNumber(); +} /** * Run all tests within each module, reporting the results to the command-line.