{"record":{"id":"6c9d73eb3e4c0746","repo":"oxc-project/oxc","slug":"test-has-no-assertions","errorCode":null,"errorMessage":"Test has no assertions","messagePattern":"Test has no assertions","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/shared/jest_vitest/expect_expect.rs","lineNumber":26,"sourceCode":"    ast::{CallExpression, Expression, FormalParameter, Function, Statement},\n};\nuse oxc_ast_visit::{VisitJs, walk_js};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_span::{GetSpan, Span};\nuse oxc_str::CompactStr;\nuse oxc_syntax::scope::ScopeFlags;\n\nuse crate::{\n    ast_util::get_declaration_of_variable,\n    context::LintContext,\n    utils::{\n        JestFnKind, JestGeneralFnKind, PossibleJestNode, convert_pattern, get_node_name,\n        is_type_of_jest_fn_call,\n    },\n};\n\nfn expect_expect_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Test has no assertions\")\n        .with_help(\"Add assertion(s) in this Test\")\n        .with_label(span)\n}\n\npub const SHORT_DESCRIPTION: &str = \"Enforce that each test has at least one `expect()` call.\";\n\npub const DOCUMENTATION: &str = r\"### What it does\n\nThis rule triggers when there is no call made to `expect` in a test, ensure that there is at least one `expect` call made in a test.\n\n### Why is this bad?\n\nPeople may forget to add assertions.\n\n### Examples\n\nExamples of **incorrect** code for this rule:\n```javascript","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/oxc-project/oxc/blob/a3d33dda7cb69da23db4fcaa2c0c05de61e760a1/crates/oxc_linter/src/rules/shared/jest_vitest/expect_expect.rs#L8-L44","documentation":"Emitted by run of the expect-expect jest/vitest rule when a test callback body contains no assertion call (no expect(...) usage, per the configured assertFunctionMatcher). It is a completeness guard catching tests that pass trivially because they never verify anything.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/shared/jest_vitest/expect_expect.rs:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add at least one expect() assertion inside the test body","If the test intentionally has no assertions, configure the rule's assertFunctionMatcher or disable it for that test"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a3d33dda7cb69da23db4fcaa2c0c05de61e760a1","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}