Skip to content

Instantly share code, notes, and snippets.

@elliotf
Created October 7, 2012 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotf/3849227 to your computer and use it in GitHub Desktop.
Save elliotf/3849227 to your computer and use it in GitHub Desktop.
non-working naive patch to get chai to tell mocha to do a string diff on assertion failures
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment