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

Enhancement/expect-to-be-close-to-with-infinity #7444

Merged
merged 10 commits into from
Dec 2, 2018
Merged

Enhancement/expect-to-be-close-to-with-infinity #7444

merged 10 commits into from
Dec 2, 2018

Conversation

joao-conde
Copy link
Contributor

Summary

For consistency it is desired that .toBeCloseTo can handle tests with Infinity.
As a tester, I want .toBeCloseTo to return true when testing Infinity with Infinity or -Infinity with -Infinity.
As a tester, I want .toBeCloseTo to return false when testing Infinity or -Infinity with any number.

Test plan

Run

yarn install

and after run the entire test suite with

yarn test

I also made some unit tests, testing for both Infinity and -Infinity with themselves aswell as both with real numbers.

My unit tests
my-tests

I ran the linter to make sure the code rules are enforced:

yarn-lint 1
yarn-lint 2

@joao-conde
Copy link
Contributor Author

joao-conde commented Nov 30, 2018

Can I get some feedback on why CI is failing? I've run the linter and the tests and both passed locally

yarn-test

CHANGELOG.md Outdated Show resolved Hide resolved
@SimenB
Copy link
Member

SimenB commented Dec 1, 2018

Restarted CI for you. Looked intermittent

@joao-conde
Copy link
Contributor Author

@SimenB CI still failling yet I do not understand the error message, could you elucidate me please? Thank you in advance

CHANGELOG.md Outdated Show resolved Hide resolved
packages/expect/src/matchers.js Outdated Show resolved Hide resolved
Co-Authored-By: joao-conde <up201503256@fe.up.pt>
Copy link
Member

@rickhanlonii rickhanlonii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after you fix the changelog 👍

packages/expect/src/matchers.js Outdated Show resolved Hide resolved
@joao-conde
Copy link
Contributor Author

  1. Applied the suggestion for the CHANGELOG item order
  2. Tried to make comments more explicit
  3. Ran linter to ensure code standards
  4. Ran the expect package tests again

CHANGELOG.md Outdated Show resolved Hide resolved
@joao-conde
Copy link
Contributor Author

joao-conde commented Dec 1, 2018

If there is anything else I can improve please let me know. What would it take for the it to be merged and close the issue #7405 ?

Copy link
Member

@rickhanlonii rickhanlonii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rickhanlonii rickhanlonii merged commit 624ac56 into jestjs:master Dec 2, 2018
@rickhanlonii
Copy link
Member

Thanks @joao-conde and congrats on your first Jest PR!

@joao-conde
Copy link
Contributor Author

@rickhanlonii the first of hopefully many, thank you!

@joao-conde joao-conde deleted the enhancement/toBeCloseTo-Infinity branch December 2, 2018 01:04
thymikee added a commit to spion/jest that referenced this pull request Dec 18, 2018
* master: (24 commits)
  Add `jest.isolateModules` for scoped module initialization (jestjs#6701)
  Migrate to Babel 7 (jestjs#7016)
  docs: changed "Great Scott!" link (jestjs#7524)
  Use reduce instead of filter+map in dependency_resolver (jestjs#7522)
  Update Configuration.md (jestjs#7455)
  Support dashed args (jestjs#7497)
  Allow % based configuration of max workers (jestjs#7494)
  chore: Standardize filenames: jest-runner pkg (jestjs#7464)
  allow `bail` setting to control when to bail out of a failing test run (jestjs#7335)
  Add issue template labels (jestjs#7470)
  chore: standardize filenames in e2e/babel-plugin-jest-hoist (jestjs#7467)
  Add node worker-thread support to jest-worker (jestjs#7408)
  Add `testPathIgnorePatterns` to CLI documentation (jestjs#7440)
  pretty-format: Omit non-enumerable symbol properties (jestjs#7448)
  Add Jest Architecture overview to docs. (jestjs#7449)
  chore: run appveyor tests on node 10
  chore: fix failures e2e test for node 8 (jestjs#7446)
  chore: update docusaurus to v1.6.0 (jestjs#7445)
  Enhancement/expect-to-be-close-to-with-infinity (jestjs#7444)
  Update CHANGELOG formatting (jestjs#7429)
  ...
willsmythe pushed a commit to willsmythe/jest that referenced this pull request Dec 20, 2018
* toBeCloseTo works properly when comparing with Infinity

* CHANGELOG update

* Linter issue solved

* Apply suggestions from code review

Co-Authored-By: joao-conde <up201503256@fe.up.pt>

* Update matchers.js

* Update CHANGELOG

* Fixed bug, leftover of old comment

* Removed unecessary self-explanatory comments

* Updated CHANGELOG

* Snapshot updates
captain-yossarian pushed a commit to captain-yossarian/jest that referenced this pull request Jul 18, 2019
* toBeCloseTo works properly when comparing with Infinity

* CHANGELOG update

* Linter issue solved

* Apply suggestions from code review

Co-Authored-By: joao-conde <up201503256@fe.up.pt>

* Update matchers.js

* Update CHANGELOG

* Fixed bug, leftover of old comment

* Removed unecessary self-explanatory comments

* Updated CHANGELOG

* Snapshot updates
@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 12, 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.

None yet

4 participants