Fixed tiny problem in assert - it was throwing errors for me until this fix #167

Closed
wants to merge 3 commits into
from
View
12 lib/assert/error.js
@@ -19,10 +19,14 @@ require('assert').AssertionError.prototype.toString = function () {
else {
expected = inspect(that.expected, {showHidden: that.actual instanceof Error});
}
-
- return str.replace(/{actual}/g, actual).
- replace(/{operator}/g, stylize(that.operator, 'bold')).
- replace(/{expected}/g, expected);
+ try {
+ return str.replace(/{actual}/g, actual).
+ replace(/{operator}/g, stylize(that.operator, 'bold')).
+ replace(/{expected}/g, expected);
+ }
+ catch(e) {
+ return str;
+ }
}
if (this.message) {