public
Created

non-working naive patch to get chai to tell mocha to do a string diff on assertion failures

  • Download Gist
chai-showDiff.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
diff --git a/chai.js b/chai.js
index 040abee..87971a8 100644
--- a/chai.js
+++ b/chai.js
@@ -277,6 +277,7 @@
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
+ this.showDiff = true;
if (options.stackStartFunction && Error.captureStackTrace) {
var stackStartFunction = options.stackStartFunction;
diff --git a/lib/chai/browser/error.js b/lib/chai/browser/error.js
index c0ac239..d8bcbff 100644
--- a/lib/chai/browser/error.js
+++ b/lib/chai/browser/error.js
@@ -12,6 +12,7 @@ function AssertionError (options) {
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
+ this.showDiff = true;
if (options.stackStartFunction && Error.captureStackTrace) {
var stackStartFunction = options.stackStartFunction;
diff --git a/lib/chai/error.js b/lib/chai/error.js
index e3c2fcc..22b69cf 100644
--- a/lib/chai/error.js
+++ b/lib/chai/error.js
@@ -33,6 +33,7 @@ function AssertionError (options) {
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
+ this.showDiff = true;
if (options.stackStartFunction && Error.captureStackTrace) {
var stackStartFunction = options.stackStartFunction;

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.