oxc-project/oxc · error · OxcDiagnostic

Test options object is missing a `timeout` property.

Error message

Test options object is missing a `timeout` property.

What it means

Emitted by the vitest/require-test-timeout rule at a test invocation whose second argument is an options object that does not include a `timeout` property. Providing options without a timeout does not satisfy the rule's requirement that each test has an explicit timeout.

Source

Thrown at crates/oxc_linter/src/rules/vitest/require_test_timeout.rs:34

    },
};

fn test_missing_timeout(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Test is missing a timeout.")
        .with_help(
            "Add a numeric third argument, a `{ timeout }` option object second argument, or call `vi.setConfig({ testTimeout: ... })` before this test.",
        )
        .with_label(span)
}

fn config_missing_timeout_object(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("`vi.setConfig()` is missing a `testTimeout` property.")
        .with_help("Pass an object with a `testTimeout` property to `vi.setConfig()`.")
        .with_label(span)
}

fn test_options_missing_timeout_property(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Test options object is missing a `timeout` property.")
        .with_help("Add a `timeout` property to the options object.")
        .with_label(span)
}

fn timeout_must_be_a_number(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Timeout must be a number.")
        .with_help("Use a non-negative numeric literal for the timeout value.")
        .with_label(span)
}

fn timeout_must_be_non_negative(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Timeout must not be negative.")
        .with_help("Use a non-negative numeric literal for the timeout value.")
        .with_label(span)
}

#[derive(Debug, Default, Clone)]
pub struct RequireTestTimeout;

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Add `timeout` to the options object, e.g. `test('name', { retry: 2, timeout: 5000 }, fn)`
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/vitest/require_test_timeout.rs:34 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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