-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
π Bug Report
When calling toEqual
on an object, where one of the values is undefined
does not compare that key.
To Reproduce
This assertion fails:
expect({foo: 1, bar: undefined}).not.toEqual({foo: 1})
β toEqual βΊ should compare objects
expect(received).not.toEqual(expected)
Expected value to not equal:
{"foo": 1}
Received:
{"bar": undefined, "foo": 1}
1 | describe('toEqual', () => {
2 | it('should compare objects', () => {
> 3 | expect({foo: 1, bar: undefined}).not.toEqual({foo: 1});
4 | });
5 | });
Expected behavior
That should pass.
Link to repl or repo (highly encouraged)
https://repl.it/repls/KeenSnappyCodewarrior
Run npx envinfo --preset jest
Paste the results here:
$ npx envinfo --preset jest
npx: installed 1 in 1.377s
System:
OS: macOS 10.14.5
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Binaries:
Node: 11.7.0 - /usr/local/homebrew/bin/node
Yarn: 1.13.0 - /usr/local/homebrew/bin/yarn
npm: 6.9.0 - /usr/local/homebrew/bin/npm
npmPackages:
jest: ^24.7.1 => 24.7.1