Add stack traces to Chai assertion failures

This commit is contained in:
Dan Stillman 2015-06-02 16:31:33 -04:00
parent dbf47a3e1e
commit ffff044ce6
2 changed files with 16 additions and 1 deletions

View file

@ -117,6 +117,21 @@ function Reporter(runner) {
});
runner.on('fail', function(test, err){
// Strip Chai lines from stack trace
err.stack = err.stack.replace(/.+zotero-unit\/chai.+\n/g, "");
// Strip "From previous event:" block if it's all internals
var re = /\s*From previous event:(.|\n)+/;
var matches = re.exec(err.stack);
if (matches) {
err.stack = err.stack.substr(0, matches.index);
var previous = matches[0].split(/\n/)
.filter(line => line.indexOf('zotero-unit/') == -1).join('\n');
if (previous.trim() != "From previous event:") {
err.stack += previous;
}
}
err.stack += "\n";
failed++;
dump("\r" + indent()
// Dark red X for errors

@ -1 +1 @@
Subproject commit d7cafca0232756f767275bb00e66930a7823b027
Subproject commit 8eab1e5f194e186a020b5abf2cd0e409e53222a2