We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b09737 commit 0b8d587Copy full SHA for 0b8d587
assert.js
@@ -58,6 +58,25 @@ assert.AssertionError = function AssertionError(options) {
58
if (Error.captureStackTrace) {
59
Error.captureStackTrace(this, stackStartFunction);
60
}
61
+ else {
62
+ // non v8 browsers so we can have a stacktrace
63
+ var err = new Error();
64
+ if (err.stack) {
65
+ var out = err.stack;
66
+
67
+ // try to strip useless frames
68
+ var fn_name = stackStartFunction.name;
69
+ var idx = out.indexOf('\n' + fn_name);
70
+ if (idx >= 0) {
71
+ // once we have located the function frame
72
+ // we need to strip out everything before it (and its line)
73
+ var next_line = out.indexOf('\n', idx + 1);
74
+ out = out.substring(next_line + 1);
75
+ }
76
77
+ this.stack = out;
78
79
80
};
81
82
// assert.AssertionError instanceof Error
0 commit comments