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

expect.hasAssertions() #3371

Closed
wants to merge 1 commit into from
Closed

expect.hasAssertions() #3371

wants to merge 1 commit into from

Conversation

mxstbr
Copy link
Contributor

@mxstbr mxstbr commented Apr 26, 2017

Summary

I want to verify that at least one assertion was called in a test, rather than a specific number of assertions.

Reference and closes #3359

Test plan

I can't figure out how to unit test for it throwing an error if there aren't any assertions, I just get a failing test 😅 would appreciate some pointers, as soon as that's tested I'll document it.

Throws if no assertions were called in a test
@cpojer
Copy link
Member

cpojer commented Apr 26, 2017

Awesome! Great to see you contributing to Jest :)

  • I'm a bit unsure why the yarn lockfile changed in jest-runtime, that's odd.
  • Check out the existing expect.assertions tests in integration_tests. Short story: we have tests that invoke a Jest test run and then ensure the right thing happens. Jestception.

@codecov-io
Copy link

Codecov Report

Merging #3371 into master will decrease coverage by 0.04%.
The diff coverage is 22.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3371      +/-   ##
==========================================
- Coverage   64.89%   64.84%   -0.05%     
==========================================
  Files         176      176              
  Lines        6521     6529       +8     
  Branches        4        4              
==========================================
+ Hits         4232     4234       +2     
- Misses       2288     2294       +6     
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-jasmine2/src/setup-jest-globals.js 0% <0%> (ø) ⬆️
packages/jest-matchers/src/index.js 95.34% <100%> (+0.11%) ⬆️

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 005ac8c...5174fcc. Read the comment docs.

@anilreddykatta
Copy link
Contributor

@mxstbr @cpojer I tried to update this pull request with integration-test, docs, removal of yarn.lock from previous pull request. I wasn't able to. I raised one more pull request with suggested changes, from the forked jest repo. Let me know of any further changes?

@thymikee
Copy link
Collaborator

@mxstbr I'll close this in favour of #3379

@thymikee thymikee closed this Apr 27, 2017
@mxstbr mxstbr deleted the has-assertions branch April 28, 2017 05:45
@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.

Make jest.assertions run for any amount of assertions
6 participants