Skip to content

Commit 5c30518

Browse files
committed
do not claim that -0 and 0 have no visual difference
1 parent 6a066c6 commit 5c30518

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
### Fixes
5252

53+
- `[jest-diff]` Do not claim that `-0` and `0` have no visual difference (TODO link)
5354
- `[expect]` `toStrictEqual` considers sparseness of arrays. ([#7591](https://github.com/facebook/jest/pull/7591))
5455
- `[jest-cli]` Fix empty coverage data for untested files ([#7388](https://github.com/facebook/jest/pull/7388))
5556
- `[jest-cli]` [**BREAKING**] Do not use `text-summary` coverage reporter by default if other reporters are configured ([#7058](https://github.com/facebook/jest/pull/7058))

packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,7 @@ exports[`.toBe() fails for: -0 and 0 1`] = `
360360
"<dim>expect(</><red>received</><dim>).toBe(</><green>expected</><dim>) // Object.is equality</>
361361

362362
Expected: <green>0</>
363-
Received: <red>-0</>
364-
365-
Difference:
366-
367-
<dim>Compared values have no visual difference.</>"
363+
Received: <red>-0</>"
368364
`;
369365

370366
exports[`.toBe() fails for: 1 and 2 1`] = `

packages/jest-diff/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const FALLBACK_FORMAT_OPTIONS_0 = Object.assign({}, FALLBACK_FORMAT_OPTIONS, {
5050
// Generate a string that will highlight the difference between two values
5151
// with green and red. (similar to how github does code diffing)
5252
function diff(a: any, b: any, options: ?DiffOptions): ?string {
53-
if (a === b) {
53+
if (Object.is(a, b)) {
5454
return NO_DIFF_MESSAGE;
5555
}
5656

0 commit comments

Comments
 (0)