oxc-project/oxc · warning · OxcDiagnostic

Test is missing function argument

Error message

Test is missing function argument

What it means

One of the four diagnostics of oxlint rule `jest/no-disabled-tests` (shared with vitest), from the Message::MissingFunction variant in crates/oxc_linter/src/rules/shared/jest/vitest/no_disabled_tests.rs. It fires when a test/it call has only a title argument and no callback function, so the test body is missing entirely.

Source

Thrown at crates/oxc_linter/src/rules/shared/jest_vitest/no_disabled_tests.rs:51

describe['skip']('bar', () => {});
it['skip']('bar', () => {});
test['skip']('bar', () => {});

xdescribe('foo', () => {});
xit('foo', () => {});
xtest('foo', () => {});

it('bar');
test('bar');

it('foo', () => {
  pending();
});
```
";

fn no_disabled_tests_diagnostic(x1: &'static str, x2: &'static str, span3: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn(x1).with_help(x2).with_label(span3)
}

enum Message {
    MissingFunction,
    Pending,
    DisabledSuiteWithSkip,
    DisabledSuiteWithX,
    DisabledTestWithSkip,
    DisabledTestWithX,
}

impl Message {
    pub fn details(&self) -> (&'static str, &'static str) {
        match self {
            Self::MissingFunction => ("Test is missing function argument", "Add function argument"),
            Self::Pending => ("Call to pending()", "Remove pending() call"),
            Self::DisabledSuiteWithSkip => ("Disabled test suite", "Remove the appending `.skip`"),
            Self::DisabledSuiteWithX => ("Disabled test suite", "Remove x prefix"),

View on GitHub (pinned to a3d33dda7c)

Solutions

  1. Add the missing callback: it('foo', () => { /* assertions */ })
  2. If the test is intentionally not written yet, use the explicit form it.todo('foo')
  3. Delete stub calls that will never be implemented rather than leaving title-only calls

Example fix

// before
it('validates user');
test('sums numbers');

// after
it('validates user', () => { expect(isUser(u)).toBe(true); });
test.todo('sums numbers');
Defensive patterns

Strategy: validation

Validate before calling

rg -n "\b(?:it|test)\(\s*['\"][^'\"]+['\"]\s*\)" tests/

Prevention

When it happens

Trigger: Exactly the condition checked at no_disabled_tests.rs:103-109: the call parses as JestGeneralFnKind::Test, `call_expr.arguments.len() < 2`, and no member is named `todo`. So `it('foo')`, `test('bar')` trigger it, while `test('todo case', ...)` with two args or `it.todo('plan')` do not.

Common situations: Scaffolding a test file and leaving empty stubs; deleting a callback during refactor and forgetting; old Jest style where `it('name')` without fn implicitly meant pending (modern Jest throws instead); merge accidents dropping the second argument.

Related errors


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