assertionsRequiresNumberArgumentThis argument should be a numbersmall-rules/prefer-expect-assertionsEnforce expect assertion guards in tests and prefer expect.assertions(n) over expect.hasAssertions() when the count is known.
assertionsRequiresNumberArgumentThis argument should be a numberassertionsRequiresOneArgument`expect.assertions` expects a single argument of type numberhasAssertionsTakesNoArguments`expect.hasAssertions` expects no argumentshaveExpectAssertionsEvery test should have either `expect.assertions(<number of assertions>)` or `expect.hasAssertions()` as its first expressionpreferAssertionsCountUse `expect.assertions({{count}})` instead of `expect.hasAssertions()` when the count is knownsuggestAddingAssertionsAdd `expect.assertions({{count}})`suggestAddingHasAssertionsAdd `expect.hasAssertions()`wrongAssertionCountExpected {{expected}} assertions, but test has {{actual}} expect callsThis rule accepts one options object after the severity.
test('works', () => { expect.hasAssertions(); expect(value).toBe(1); });After auto-fix
test('works', () => { expect.assertions(1); expect(value).toBe(1); });test('works', () => { expect.assertions(1); expect(value).toBe(1); });