You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assertions in test modules outside test functions are included in the count validated by expect.assertions() of the first test. This seems to be the same issue as described in the previously closed #5887.
beforeAll(()=>{expect(0).toBe(0);});// Uncommenting this stops the first test failing// test('dummy', () => undefined);// The first test here fails (with 2 assertions instead of 1),// second and third pass.test.each([[1],[2],[3]])('example test %# ',x=>{expect.assertions(1);expect(x).toBeGreaterThan(0);});
Expected behavior
The assertion count validated by expect.assertions() in test functions should be independent of assertions made in test setup code.
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
This issue 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.
馃悰 Bug Report
Assertions in test modules outside test functions are included in the count validated by
expect.assertions()
of the first test. This seems to be the same issue as described in the previously closed #5887.To Reproduce
Clone this example/reproduction repo, npm install and run the tests; they'll fail but should pass: https://github.com/h4l/jest-expect-assertions-bug
Example from that repo:
Expected behavior
The assertion count validated by
expect.assertions()
in test functions should be independent of assertions made in test setup code.Link to repl or repo (highly encouraged)
Reproduction repo: https://github.com/h4l/jest-expect-assertions-bug
envinfo
The text was updated successfully, but these errors were encountered: