Skip to content

toStrictEqual does not consider arrays with objects having undefined values correctly #7937

@dubzzz

Description

@dubzzz

💥 Regression Report

toStrictEqual does not consider arrays with objects having undefined values correctly.

Starting at 24.0.0, [{a: undefined}] is strict equal to [{}] - while {a: undefined} and {} are not strict equal.

Last working version

Worked up to version: 23.6.0

Stopped working in version: 24.0.0

To Reproduce

Steps to reproduce the behavior:

// Fails starting at 24.0.0
expect([{a: undefined}]).not.toStrictEqual([{}]);

// While the following is still true
expect({a: undefined}).not.toStrictEqual({});

Expected behavior

The following assertion should not fail:

expect([{a: undefined}]).not.toStrictEqual([{}]);

Indeed {a: undefined} is not {}.

Run npx envinfo --preset jest

Paste the results here:

$ npx envinfo --preset jest
npx : 1 installé(s) en 4.679s

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  Binaries:
    Node: 10.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.10.1 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.7.0 - C:\Program Files\nodejs\npm.CMD

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