Skip to content

Commit b0c697f

Browse files
author
Mahdi Dibaiee
committed
Set Error.stackTraceLimit to infinity
Update beautifulStack's RegExp Do not modify original error's stack property
1 parent 95c8d43 commit b0c697f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ var Runner = require('./lib/runner');
77
var log = new Squeak({separator: ' '});
88
var runner = new Runner();
99

10+
Error.stackTraceLimit = Infinity;
11+
1012
log.type('success', {
1113
color: 'green',
1214
prefix: figures.tick
@@ -38,7 +40,7 @@ function stack(results) {
3840

3941
// Don't print the full stack but the only useful line showing
4042
// the actual test file stack
41-
var reg = /\((?:[\\\/](?:(?!node_modules[\\\/]ava[\\\/])[^:\\\/])+)+:\d+:\d+\)/;
43+
var reg = /(?:^(?! {4}at\b).{6})|(?:\((?:[\\\/](?:(?!node_modules[\\\/]ava[\\\/])[^:\\\/])+)+:\d+:\d+\))/;
4244
function beautifulStack(stack) {
4345
var found = false;
4446
return stack.split('\n').filter(function (line) {
@@ -47,10 +49,10 @@ function stack(results) {
4749
return !found || relevant;
4850
}).join('\n');
4951
}
50-
result.error.stack = beautifulStack(result.error.stack);
52+
var stack = beautifulStack(result.error.stack);
5153

5254
log.writelpad(chalk.red(i + '.', result.title));
53-
log.writelpad(chalk.red(result.error.stack));
55+
log.writelpad(chalk.red(stack));
5456
log.write();
5557
});
5658
}

0 commit comments

Comments
 (0)