jasmine adapter with better stack traces

This commit is contained in:
Igor Minar 2011-01-07 11:58:08 -08:00
parent 9db2170dcf
commit c0a26b1853

View file

@ -45,7 +45,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(
@ -73,7 +73,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 = {};