Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cause deep.have.same.members() to print a diff. #509

Merged
merged 1 commit into from
Oct 2, 2015
Merged

Cause deep.have.same.members() to print a diff. #509

merged 1 commit into from
Oct 2, 2015

Conversation

MorganEPatch
Copy link

As it is, when the above assertion fails, one gets the rather unhelpful error message "expected [ Array(n) ] to have the same members as [ Array(m) ]". If the arrays are the same size, but some value in them is different, this isn't very helpful. It usually ends with me printing out the two arrays to the console and attempting to do a diff myself anyway.

By simply passing showDiff = true to assert() , it indicates that the arrays should be diffed when the error is printed. This functionality is tested in mocha 2.2.5 for both cases where either array is missing a value in the other and where the value differs between the arrays.

keithamus added a commit that referenced this pull request Oct 2, 2015
Cause deep.have.same.members() to print a diff.
@keithamus keithamus merged commit ac78e36 into chaijs:4.x.x Oct 2, 2015
@keithamus
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants