-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
🐛 Bug Report
After upgrading to jest 25.x.x, when comparing 2 different React Components with
expect(<...>).toEqual(<...>)
there's an TypeError instead of a report of the differences between the components.
To Reproduce
expect(<div prop1="" />).toEqual(<div/>)
TypeError: Cannot assign to read only property 'props' of object '#<Object>'
3 | test('renders learn react link', () => {
4 | expect(<div/>).toEqual(<div/>)
> 5 | expect(<div prop1="" />).toEqual(<div/>)
| ^
6 | });
7 |
at Object.<anonymous> (src/App.test.js:5:28)
Expected behavior
It works fine in jest 24.9
expect(received).toEqual(expected) // deep equality
- Expected
+ Received
- <div />
+ <div
+ prop1=""
+ />
Link to repl or repo (highly encouraged)
git clone git@github.com:dpinol/jest-react-toEqual-bug.git
cd jest-react-toEqual-bug
npm i -D
npm run test
envinfo
AlfieBrooks, wvanvugt-speedline, FabianSellmann, protoEvangelion, jacek-rzrz and 4 more