oxc-project/oxc · error · OxcDiagnostic

Test is missing a timeout.

Error message

Test is missing a timeout.

What it means

Emitted by the vitest/require-test-timeout rule at a test (or concurrent test) invocation that sets no timeout — no numeric third argument, no `{ timeout }` option object, and no prior `vi.setConfig({ testTimeout: ... })`. Without an explicit timeout the default applies, which the project wants avoided for slow/async tests.

Source

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

    AstKind,
    ast::{Argument, Expression, ObjectPropertyKind, UnaryOperator},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::{GetSpan, Span};

use crate::{
    context::LintContext,
    rule::Rule,
    rules::PossibleJestNode,
    utils::{
        JestFnKind, JestGeneralFnKind, KnownMemberExpressionProperty,
        collect_possible_jest_call_node, parse_general_jest_fn_call,
    },
};

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)
}

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Pass a numeric third argument: `test('name', fn, 5000)`
  2. Or pass an options object: `test('name', { timeout: 5000 }, fn)`
  3. Or set a global default earlier via `vi.setConfig({ testTimeout: 5000 })`
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/vitest/require_test_timeout.rs:20 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/a98da7310d8c372c. Report an issue: GitHub.