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

Adding .hasAssertions to expect API #3379

Merged
merged 3 commits into from
Apr 28, 2017
Merged

Adding .hasAssertions to expect API #3379

merged 3 commits into from
Apr 28, 2017

Conversation

anilreddykatta
Copy link
Contributor

@anilreddykatta anilreddykatta commented Apr 27, 2017

Fixes #3371

  1. Updated docs for .hasAssertions API Change
  2. Added test cases in integration-tests
  3. Removed yarn.lock from pull request

Summary

Test plan
Unit test cases along with integration tests have been added.

@codecov-io
Copy link

codecov-io commented Apr 27, 2017

Codecov Report

Merging #3379 into master will decrease coverage by 0.04%.
The diff coverage is 47.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3379      +/-   ##
==========================================
- Coverage   64.09%   64.04%   -0.05%     
==========================================
  Files         177      177              
  Lines        6561     6570       +9     
  Branches        4        4              
==========================================
+ Hits         4205     4208       +3     
- Misses       2355     2361       +6     
  Partials        1        1
Impacted Files Coverage Δ
...ges/pretty-format/src/plugins/AsymmetricMatcher.js 100% <ø> (ø) ⬆️
packages/jest-jasmine2/src/setup-jest-globals.js 0% <0%> (ø) ⬆️
packages/jest-jasmine2/src/jest-expect.js 0% <0%> (ø) ⬆️
packages/jest-matchers/src/index.js 95.4% <100%> (+0.16%) ⬆️

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 3efa3b9...9ff3ce0. Read the comment docs.

@thymikee thymikee mentioned this pull request Apr 27, 2017
Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Nice work! Left some inline comments for you.


expect.hasAssertions()

Expected at least one assertion to be called but no assertions were called.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Expected at least one assertion to be called but received none.

maybe?

@@ -57,6 +57,7 @@ if (!global[GLOBAL_STATE]) {
state: {
assertionCalls: 0,
assertionsExpected: null,
expectedAssertions: false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about:

expectedAssertionsNumber: null, 
isExpectingAssertions: false,

Seems a bit more descriptive. assertionsExpected and expectedAssertions don't tell much to me.

@thymikee
Copy link
Collaborator

cc: @mxstbr

Copy link
Contributor

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

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

Awesome, looks great!

@cpojer
Copy link
Member

cpojer commented Apr 28, 2017

Alright, I fixed everything up and made the flow typing a bit better so that all of this is actually working properly :)

anilreddykatta and others added 3 commits April 28, 2017 17:27
2. Added test cases in `integration-tests`
3. Removed `yarn.lock` from pull request
Rebasing with master, resolved conflicts
@cpojer cpojer merged commit e56103c into jestjs:master Apr 28, 2017
@SimenB
Copy link
Member

SimenB commented Apr 28, 2017

@anilreddykatta
Copy link
Contributor Author

Thanks @cpojer

@cpojer
Copy link
Member

cpojer commented Apr 28, 2017

@SimenB yes! @anilreddykatta do you wanna send a PR for the eslint plugin change? :)

@SimenB
Copy link
Member

SimenB commented Apr 29, 2017

Might actually have to update the code there, unsure if it handles a function directly on expect now (which is no error was triggered by the linter now)

@anilreddykatta
Copy link
Contributor Author

@cpojer I didn't quite get what you mean. Do you mind elaborating a bit? I can definitely raise a PR. 😄

@diegohaz
Copy link

diegohaz commented May 1, 2017

Just adding the issue reference so people can find it: #3359

@SimenB
Copy link
Member

SimenB commented May 1, 2017

@anilreddykatta It was a bit more involved than just adding to an array, so I sent a PR for it: #3426

tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
* 1. Updated docs for `.hasAssertions` API Change
2. Added test cases in `integration-tests`
3. Removed `yarn.lock` from pull request

* Adding suggested changes

Rebasing with master, resolved conflicts

* Fixes + improved flow types.
@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.

8 participants