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"
}
}
How to use ​
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny jest/expect-expect --jest-plugin
json
{
"plugins": ["jest"],
"rules": {
"jest/expect-expect": "error"
}
}