Skip to content

Commit

Permalink
prettier stack traces
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar authored and ibolmo committed Apr 16, 2011
1 parent 93f3495 commit bfb35ff
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/JasmineAdapter.js
Expand Up @@ -46,7 +46,7 @@
if (!resultItems[i].passed()) {
state = resultItems[i].message.match(/AssertionError:/) ? 'error' : 'failed';
messages.push(resultItems[i].toString());
messages.push(resultItems[i].trace.stack);
messages.push(formatStack(resultItems[i].trace.stack));
}
}
onTestDone(
Expand Down Expand Up @@ -74,7 +74,18 @@
}
};
jstestdriver.pluginRegistrar.register(jasminePlugin);


function formatStack(stack) {
var lines = (stack||'').split(/\r?\n/);
var frames = [];
for (i = 0; i < lines.length; i++) {
if (!lines[i].match(/\/jasmine[\.-]/)) {
frames.push(lines[i].replace(/https?:\/\/\w+(:\d+)?\/test\//, '').replace(/^\s*/, ' '));
}
}
return frames.join('\n');
}

function noop(){}
function Describes(window){
var describes = {};
Expand Down

0 comments on commit bfb35ff

Please sign in to comment.