Skip to content

Commit

Permalink
Fix non ES5 compliant regexp
Browse files Browse the repository at this point in the history
ES5 appears to require that { be escaped when not used as part of a quantifier. While this works fine in browsers it appears to choke less lenient runtimes (e.g. Duktape).
  • Loading branch information
zetaben committed Dec 23, 2015
1 parent a4b253d commit 37e9d25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/chai/utils/getMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ module.exports = function (obj, args) {
if(typeof msg === "function") msg = msg();
msg = msg || '';
msg = msg
.replace(/#{this}/g, function () { return objDisplay(val); })
.replace(/#{act}/g, function () { return objDisplay(actual); })
.replace(/#{exp}/g, function () { return objDisplay(expected); });
.replace(/#\{this\}/g, function () { return objDisplay(val); })
.replace(/#\{act\}/g, function () { return objDisplay(actual); })
.replace(/#\{exp\}/g, function () { return objDisplay(expected); });

return flagMsg ? flagMsg + ': ' + msg : msg;
};

0 comments on commit 37e9d25

Please sign in to comment.