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

Human-readable messages should be provided when arrays / objects deep equal assertions fail #939

Closed
fakiolinho opened this issue Feb 26, 2017 · 2 comments

Comments

@fakiolinho
Copy link

I am using jest 19.0.2 and chai 3.5.0 and i am trying to run some assertions for my Redux reducers. I am trying to compare 2 objects by using:

import { expect } from 'chai';
...
expect(...).to.eql(...);

This is the result i am getting:

screenshot at feb 26 18-12-42

As you see this is not that declarative and helpful since i cannot spot the exact keys where this assertion fails. Same result i am getting if i use assert.deepEqual(...); and expect(...).to.deep.equal(...);

If i use expect 1.20.2 with exact same setup and run sth like expect(...).toEqual(...); this is the error i am getting:

screenshot at feb 26 18-11-29

@meeber
Copy link
Contributor

meeber commented Feb 26, 2017

Hi @fakiolinho. In general, there's a lot of room for improvement in the Chai failed assertion messages. It's on the roadmap (#457) to do a refactor.

With that said, the particular problem you noted might be resolvable by fiddling with the chai.config.truncateThreshold value documented here. Setting it to 0 will disable truncation completely.

@meeber meeber closed this as completed Feb 26, 2017
@fakiolinho
Copy link
Author

Thanks @meeber for getting back to me. Didn't know about that. I 'll definitely start using it!!

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