> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# require-local-test-context-for-concurrent-snapshots

[Added in v0.8.2](https://github.com/web-infra-dev/rslint/releases/tag/v0.8.2)
## Configuration

| Preset                             | Configured Value |
| ---------------------------------- | ---------------- |
| ✅ rstestPlugin.configs.all         | `"warn"`         |
| ✅ rstestPlugin.configs.recommended | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, rstestPlugin } from '@rslint/core';

export default defineConfig([
  rstestPlugin.configs.recommended,
  {
    rules: {
      'rstest/require-local-test-context-for-concurrent-snapshots': 'error',
    },
  },
]);
```

## Rule Details

Requires concurrent tests to use the `expect` from their local Test Context for snapshot assertions. A shared global or imported `expect` can mix snapshot state between tests that run at the same time.

The rule checks snapshot matchers in concurrent tests, including concurrent suites and parameterized tests. It requires type information to identify the local Test Context.

## Incorrect

```ts
test.concurrent('renders a user', () => {
  expect(renderUser()).toMatchSnapshot();
});
```

## Correct

```ts
test.concurrent('renders a user', ({ expect }) => {
  expect(renderUser()).toMatchSnapshot();
});
```
