{"record":{"id":"6d767ea128ee55c4","repo":"oxc-project/oxc","slug":"require-local-test-context-for-concurrent-snapshot","errorCode":null,"errorMessage":"Require local Test Context for concurrent snapshot tests","messagePattern":"Require local Test Context for concurrent snapshot tests","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vitest/require_local_test_context_for_concurrent_snapshots.rs","lineNumber":39,"sourceCode":"    )\n}\n\n#[inline]\nfn is_test_or_describe_node(member_expr: &MemberExpression) -> bool {\n    if let Some(id) = member_expr.object().get_identifier_reference()\n        && matches!(\n            JestFnKind::from(id.name.as_str()),\n            JestFnKind::General(JestGeneralFnKind::Describe | JestGeneralFnKind::Test)\n        )\n        && let Some(property_name) = member_expr.static_property_name()\n    {\n        return property_name == \"concurrent\";\n    }\n    false\n}\n\nfn require_local_test_context_for_concurrent_snapshots_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Require local Test Context for concurrent snapshot tests\")\n        .with_help(\"Use local Test Context instead\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireLocalTestContextForConcurrentSnapshots;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// The rule is intended to ensure that concurrent snapshot tests are executed\n    /// within a properly configured local test context.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Running snapshot tests concurrently without a proper context can lead to\n    /// unreliable or inconsistent snapshots. Ensuring that concurrent tests are\n    /// correctly configured with the appropriate context helps maintain accurate","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vitest/require_local_test_context_for_concurrent_snapshots.rs#L21-L57","documentation":"Emitted by the vitest/require-local-test-context-for-concurrent-snapshots rule at a `describe.concurrent`/`test.concurrent` usage that performs snapshot assertions. Concurrent tests in a shared worker share snapshot state, which corrupts results unless a local test context is used.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vitest/require_local_test_context_for_concurrent_snapshots.rs:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Accept a local test context in the concurrent test, e.g. `test.concurrent('...', ({ expect }) => { expect(...).toMatchSnapshot() })` and use the context's `expect` for snapshots"],"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"}