Assertion calls in helper functions seem to count toward the limit of max-expects when the function is declared after the test body, even if it is not called by the test body.
Reproduction: https://github.com/spdiswal/eslint-plugin-jest-max-expects
test("foo", function () {
expectNonNullString("hello world")
expect(true).toBe(true)
})
test("bar", function () {
expect(true).toBe(true)
expect(true).toBe(true)
expect(true).toBe(true)
expect(true).toBe(true)
expect(true).toBe(true)
})
function expectNonNullString(obj) {
expect(obj).not.toBe(null)
expect(typeof obj).toBe("string")
}
15:2 error Too many assertion calls (6). Maximum allowed is 5 jest/max-expects
16:2 error Too many assertion calls (7). Maximum allowed is 5 jest/max-expects