Skip to content
← Back to rules

jest/prefer-todo Style

🛠️ An auto-fix is available for this rule.

What it does ​

When test cases are empty then it is better to mark them as test.todo as it will be highlighted in the summary output.

Why is this bad? ​

This rule triggers a warning if empty test cases are used without 'test.todo'.

Examples ​

Examples of incorrect code for this rule:

javascript
test("i need to write this test"); // invalid
test("i need to write this test", () => {}); // invalid
test.skip("i need to write this test", () => {}); // invalid

Examples of correct code for this rule:

javascript
test.todo("i need to write this test");

How to use ​

To enable this rule using the config file or in the CLI, you can use:

json
{
  "plugins": ["jest"],
  "rules": {
    "jest/prefer-todo": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["jest"],
  rules: {
    "jest/prefer-todo": "error",
  },
});
bash
oxlint --deny jest/prefer-todo --jest-plugin

Version ​

This rule was added in v0.0.16.

References ​