oxc-project/oxc · warning

Suggest using `test.todo`.

Error message

Suggest using `test.todo`.

What it means

Warning from the oxlint `jest/prefer-todo` rule (source: crates/oxc_linter/src/rules/shared/jest_vitest/prefer_todo.rs:14). It fires on `test()`/`it()` calls whose callback body is empty, and suggests `test.todo(title)`, which jest and vitest surface in the summary output and never execute, making unfinished work visible instead of silently green.

Source

Thrown at crates/oxc_linter/src/rules/shared/jest_vitest/prefer_todo.rs:14

use oxc_ast::{
    AstKind,
    ast::{Argument, CallExpression, Expression},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_span::{GetSpan, Span};

use crate::{
    context::LintContext,
    utils::{JestFnKind, JestGeneralFnKind, PossibleJestNode, is_type_of_jest_fn_call},
};

fn prefer_todo_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Suggest using `test.todo`.").with_label(span)
}

pub const DOCUMENTATION: &str = r"### 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

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Convert the empty test to a todo: `test.todo('does something')`.
  2. Or implement the test body - any statement removes the warning.
  3. Suppress deliberately-kept placeholders with `// oxlint-disable-next-line jest/prefer-todo`.

Example fix

// before
test('handles retry logic', () => {});

// after
test.todo('handles retry logic');
Defensive patterns

Strategy: validation

Validate before calling

// rg -nU "(test|it)\([^)]*,\s*\(\)\s*=>\s*\{\s*\}" tests/ -t ts -t js

Prevention

When it happens

Trigger: `test('does something', () => {});` or `it('works', () => {})` - a test or it call (identified via `is_type_of_jest_fn_call` with `JestGeneralFnKind`) whose callback contains no statements.

Common situations: Scaffolding tests to fill in later and forgetting them; TDD leftovers where the implementation step was dropped; PRs that accidentally merge empty stubs because the suite still passes.

Related errors


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/94290e3f29be8c4b. Report an issue: GitHub.