Skip to content

Make toBe matcher error message more helpful for objects and arrays #4228

@thymikee

Description

@thymikee

Do you want to request a feature or report a bug?
Enhancement

What is the current behavior?
Using expect(object).toBe(otherObject) fails with default message.

What is the expected behavior?
Since this is a common mistake, we could detect if the received entity is an object or an array and display helpful message like:

Looks like you wanted to test for object/array equity with strict `toBe` matcher. 
You probably need to use `toEqual` instead.

We can figure out better wording, this is just an idea :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions