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

How to implement json-diff like mocha ? #1060

Closed
bertho-zero opened this issue Oct 5, 2017 · 2 comments
Closed

How to implement json-diff like mocha ? #1060

bertho-zero opened this issue Oct 5, 2017 · 2 comments

Comments

@bertho-zero
Copy link

It is currently not possible to see the differences of an object/table directly with the chai configuration, which makes debugging tests really complicated when dealing with large objects.

How is it possible to integrate json-diff for all AssertionError, like with mocha ?
Do you intend to make this natively configurable with chai ?

@keithamus
Copy link
Member

keithamus commented Oct 5, 2017

Hey @bertho-zero thanks for the issue.

Chai doesn't do any diffing at current. It passes the actual and expected fields inside the AssertionError object for the reporter to do diffing. If you aren't using mocha, then whatever test runner you are using will need to support diffing by introspecting the error.actual and error.expected properties.

I'll close this issue; as its not a bug within our code. Feel free to continue the conversation though, and we can always re-open the issue if there is a need to 😄

@bertho-zero
Copy link
Author

Finally I used this chai plugin that works perfectly: https://www.npmjs.com/package/chai-jest-diff

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

No branches or pull requests

2 participants