-
Notifications
You must be signed in to change notification settings - Fork 629
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
fix(expect,internal,testing): support expect.assertions
#6032
fix(expect,internal,testing): support expect.assertions
#6032
Conversation
expect.assertions
apiexpect.assertions
expect.assertions
expect.assertions
expect.assertions
expect.assertions
internal/assertion_state.ts
Outdated
*/ | ||
checkAssertionCountSatisfied(): boolean { | ||
return this.#state.assertionCount !== undefined && | ||
this.#state.assertionCount > this.#state.assertionTriggeredCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems in jest, expect.assertions(N)
call expects exactly N
assertions are made. For example, the below test file fails with the error message Expected one assertion to be called but received two assertion calls.
:
test("test", () => {
expect.assertions(1);
expect(1).toBe(1);
expect(2).toBe(2);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've updated.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6032 +/- ##
==========================================
- Coverage 96.58% 96.51% -0.08%
==========================================
Files 536 536
Lines 40679 40744 +65
Branches 6110 6115 +5
==========================================
+ Hits 39291 39323 +32
- Misses 1344 1377 +33
Partials 44 44 ☔ View full report in Codecov by Sentry. |
I will land this as another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for your contribution!
Part of #3964, support
expect.assertions
api