{"record":{"id":"2ec95ea930389374","repo":"oxc-project/oxc","slug":"expect-member-name-must-be-awaited-or-returned","errorCode":null,"errorMessage":"`expect.{member_name}` must be awaited or returned","messagePattern":"`expect\\.(.+?)` must be awaited or returned","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vitest/require_awaited_expect_poll.rs","lineNumber":16,"sourceCode":"use oxc_allocator::GetAddress;\nuse oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::Rule,\n    rules::PossibleJestNode,\n    utils::{KnownMemberExpressionProperty, parse_expect_and_typeof_vitest_fn_call},\n};\n\nfn require_awaited_expect_poll_diagnostic(span: Span, member_name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"`expect.{member_name}` must be awaited or returned\"))\n        .with_help(format!(\"Add `await` to the `expect.{member_name}` call.\"))\n        .with_label(span)\n}\n\nfn require_awaited_expect_poll_return_diagnostic(span: Span, member_name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"`expect.{member_name}` must be awaited or returned as the last expression\"))\n          .with_help(format!(\"Add `await` to the `expect.{member_name}` call or move it to the last position in the sequence.\"))\n          .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireAwaitedExpectPoll;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// This rule ensures that promises returned by `expect.poll` and `expect.element` calls are handled properly.\n    ///","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vitest/require_awaited_expect_poll.rs#L1-L34","documentation":"Emitted by the vitest/require-awaited-expect-poll rule at an `expect.poll(...)` / `expect.element`-style call that is neither awaited nor returned from the test. Un-awaited poll assertions resolve asynchronously, so the test can finish before the assertion ever runs, silently passing without checking anything.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vitest/require_awaited_expect_poll.rs:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add `await` to the `expect.poll(...)` call","Or return the assertion from the test callback so it is awaited by the runner"],"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-14T05:17:10.506Z"}