Skip to content

toStrictEqual fails to distinguish 0 from 5e-324 #7941

@dubzzz

Description

@dubzzz

🐛 Bug Report

While trying to automate the detection of bugs and regressions in Jest (see my previous PR #7938), I found a very strange failing case in toStrictEqual:

expect(0).not.toStrictEqual(5e-324) // throws

//    expect(received).not.toStrictEqual(expected)
//
//    Expected: 5e-324
//    Received: 0

To Reproduce

Steps to reproduce the behavior: expect(0).not.toStrictEqual(5e-324)

Expected behavior

I would have expect Jest to succeed to distinguish 0 from 5e-324.

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

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions