Skip to content

Commit fd44e08

Browse files
committed
[fix v0.6] No error.stack for nextTick errors
1 parent eac4362 commit fd44e08

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/assert/error.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ var inspect = require('../vows/console').inspect;
33

44
require('assert').AssertionError.prototype.toString = function () {
55
var that = this,
6+
source;
7+
8+
if (this.stack) {
69
source = this.stack.match(/([a-zA-Z0-9._-]+\.js)(:\d+):\d+/);
10+
}
711

812
function parse(str) {
913
return str.replace(/{actual}/g, inspect(that.actual)).
@@ -15,7 +19,7 @@ require('assert').AssertionError.prototype.toString = function () {
1519

1620
if (this.message) {
1721
return stylize(parse(this.message), 'yellow') +
18-
stylize(' // ' + source[1] + source[2], 'grey');
22+
(source) ? stylize(' // ' + source[1] + source[2], 'grey') : '';
1923
} else {
2024
return stylize([
2125
this.expected,

0 commit comments

Comments
 (0)