{"record":{"id":"66a74d8ee774d4fb","repo":"oxc-project/oxc","slug":"timeout-must-not-be-negative","errorCode":null,"errorMessage":"Timeout must not be negative.","messagePattern":"Timeout must not be negative\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vitest/require_test_timeout.rs","lineNumber":46,"sourceCode":"    OxcDiagnostic::warn(\"`vi.setConfig()` is missing a `testTimeout` property.\")\n        .with_help(\"Pass an object with a `testTimeout` property to `vi.setConfig()`.\")\n        .with_label(span)\n}\n\nfn test_options_missing_timeout_property(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Test options object is missing a `timeout` property.\")\n        .with_help(\"Add a `timeout` property to the options object.\")\n        .with_label(span)\n}\n\nfn timeout_must_be_a_number(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Timeout must be a number.\")\n        .with_help(\"Use a non-negative numeric literal for the timeout value.\")\n        .with_label(span)\n}\n\nfn timeout_must_be_non_negative(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Timeout must not be negative.\")\n        .with_help(\"Use a non-negative numeric literal for the timeout value.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireTestTimeout;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Requires every test to have a timeout specified, either as a numeric third\n    /// argument, a `{ timeout }` option, or via `vi.setConfig({ testTimeout: ... })`.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Tests without an explicit timeout rely on the default, which may be too\n    /// generous to catch performance regressions or too short for slow CI\n    /// environments, leading to flaky failures.","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vitest/require_test_timeout.rs#L28-L64","documentation":"Fires in the vitest require-test-timeout rule when parse_timeout_value encounters a negative numeric timeout literal. It is a validation guard rejecting any timeout value below zero, which vitest treats as invalid because a test cannot wait for a negative duration.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vitest/require_test_timeout.rs:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the timeout to a non-negative number of milliseconds","Remove the timeout option to use the configured default test timeout"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}