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

Better user experience when using .include without .deep. #1619

Open
koddsson opened this issue May 16, 2024 · 0 comments
Open

Better user experience when using .include without .deep. #1619

koddsson opened this issue May 16, 2024 · 0 comments

Comments

@koddsson
Copy link
Member

Given the following assertion:

expect({ tags: {} }).to.include({ tags: {} });

You get the following assertion error:

AssertionError: expected { tags: {} } to have property 'tags' of {}, but got {}

For those of us that have read the guide know that I really want to do:

expect({ tags: {} }).to.deep.include({ tags: {} });

According to the guide using .deep:

Causes all .equal, .include, .members, .keys, and .property assertions that follow in the chain to use deep equality instead of strict (===) equality. See the deep-eql project page for info on the deep equality algorithm: https://github.com/chaijs/deep-eql.

This isn't obvious from the usage though. I wonder if we could improve the user experience by point the user towards .deep in the assertion error?

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

1 participant