Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace identity equality with Object.is in toBe matcher #4917

Merged
merged 1 commit into from
Nov 20, 2017

Conversation

mkubilayk
Copy link
Contributor

Summary

This replaces the strict equality (===) check with Object.is in the toBe matcher. Object.is works exactly the same as triple equals except:

> Object.is(NaN, NaN)
true
> NaN === NaN
false
> Object.is(-0, +0)
false
> -0 === +0
true

Hence, this allows us to fix #4907.

Test plan

Added two tests for toBe matcher. I couldn't test the docs due to #4911 and #4912, but changes are trivial.

@codecov-io
Copy link

Codecov Report

Merging #4917 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4917   +/-   ##
=======================================
  Coverage   59.98%   59.98%           
=======================================
  Files         198      198           
  Lines        6563     6563           
  Branches        4        4           
=======================================
  Hits         3937     3937           
  Misses       2626     2626

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9303ecf...2e9fd3d. Read the comment docs.

@cpojer
Copy link
Member

cpojer commented Nov 20, 2017

This is great! Thank you so much.

@cpojer cpojer merged commit 57efef0 into jestjs:master Nov 20, 2017
@mkubilayk mkubilayk deleted the tobe-nan branch November 20, 2017 09:30
@SimenB
Copy link
Member

SimenB commented Dec 9, 2017

This needs an entry in the changelog (in general, all should be there, but this in particular is a breaking change, so should definitely be there). @mkubilayk wanna send a PR for it?

@mkubilayk
Copy link
Contributor Author

@SimenB sure, will send it today.

@mkubilayk mkubilayk mentioned this pull request Dec 9, 2017
@mkubilayk
Copy link
Contributor Author

@SimenB #5043.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NaN check
5 participants