# no-interpolation-in-snapshots

Rule `jest/no-interpolation-in-snapshots`. Disallow string interpolation inside snapshots

- Source: jest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 16.7M weekly downloads of presets that enable it
- Trend: +10.1% last quarter
- Rank: #662 by reach, #1469 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `jest/no-interpolation-in-snapshots` | yes | no | package `eslint-plugin-jest` | [docs](https://github.com/jest-community/eslint-plugin-jest/blob/v29.17.2/docs/rules/no-interpolation-in-snapshots.md) |
| Oxlint | `jest/no-interpolation-in-snapshots` | no | no | plugin `jest`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/jest/no-interpolation-in-snapshots.html) |

## Code examples

### Incorrect: the rule reports this

```js
expect(something).toMatchInlineSnapshot(
  `Object {
    property: ${interpolated}
  }`,
);

expect(something).toMatchInlineSnapshot(
  { other: expect.any(Number) },
  `Object {
    other: Any<Number>,
    property: ${interpolated}
  }`,
);

expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot(
  `${interpolated}`,
);
```

### Correct: the rule accepts this

```js
expect(something).toMatchInlineSnapshot();

expect(something).toMatchInlineSnapshot(
  `Object {
    property: 1
  }`,
);

expect(something).toMatchInlineSnapshot(
  { property: expect.any(Date) },
  `Object {
    property: Any<Date>
  }`,
);

expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot();

expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot(
  `Error Message`,
);
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import jest from "eslint-plugin-jest";

export default [
  {
    plugins: { jest },
    rules: {
      "jest/no-interpolation-in-snapshots": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "jest"
  ],
  "rules": {
    "jest/no-interpolation-in-snapshots": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Jest recommended](https://lintradar.dev/presets/jest-recommended.md) | ESLint | `eslint-plugin-jest` | 19 | 16.7M | +10.1% |

## Related rules

- [vitest/no-interpolation-in-snapshots](https://lintradar.dev/rules/vitest/no-interpolation-in-snapshots.md): Disallow string interpolation in snapshots
- [jest/no-deprecated-functions](https://lintradar.dev/rules/jest/no-deprecated-functions.md): Disallow use of deprecated functions
- [jest/no-mocks-import](https://lintradar.dev/rules/jest/no-mocks-import.md): Disallow manually importing from `__mocks__`
- [jest/no-commented-out-tests](https://lintradar.dev/rules/jest/no-commented-out-tests.md): Disallow commented out tests
- [jest/no-test-prefixes](https://lintradar.dev/rules/jest/no-test-prefixes.md): Require using `.only` and `.skip` over `f` and `x`
- [jest/no-alias-methods](https://lintradar.dev/rules/jest/no-alias-methods.md): Disallow alias methods

---

Web page: https://lintradar.dev/rules/jest/no-interpolation-in-snapshots. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
