Skip to content

jest/expect-expect Correctness

What it does

This rule triggers when there is no call made to expect in a test, ensure that there is at least one expect call made in a test.

Why is this bad?

People may forget to add assertions.

Example

javascript
it("should be a test", () => {
  console.log("no assertion");
});
test("should assert something", () => {});

This rule is compatible with eslint-plugin-vitest, to use it, add the following configuration to your .eslintrc.json:

json
{
  "rules": {
    "vitest/expect-expect": "error"
  }
}

References

Released under the MIT License.