# no-test-return-statement

Rule `vitest/no-test-return-statement`. Disallow return statements in tests

- Source: vitest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1685 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vitest/no-test-return-statement` | no | no | package `@vitest/eslint-plugin` | [docs](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md) |
| Oxlint | `vitest/no-test-return-statement` | no | no | plugin `vitest`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-test-return-statement.html) |
| Biome | `nursery/noReturnInTest` | yes | no | group nursery, since 2.6.9 | [docs](https://biomejs.dev/linter/rules/no-return-in-test/) |

## Code examples

### Incorrect: the rule reports this

```ts
import { test } from 'vitest'

test('foo', () => {
  return expect(1).toBe(1)
})
```

### Correct: the rule accepts this

```ts
import { test } from 'vitest'

test('foo', () => {
  expect(1).toBe(1)
})
```

Examples from the ESLint documentation.

## Enable it

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

```js
import vitest from "@vitest/eslint-plugin";

export default [
  {
    plugins: { vitest },
    rules: {
      "vitest/no-test-return-statement": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "vitest"
  ],
  "rules": {
    "vitest/no-test-return-statement": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noReturnInTest": "error"
      }
    }
  }
}
```

## Related rules

- [jest/no-test-return-statement](https://lintradar.dev/rules/jest/no-test-return-statement.md): Disallow explicitly returning from tests
- [vitest/no-hooks](https://lintradar.dev/rules/vitest/no-hooks.md): Disallow setup and teardown hooks
- [vitest/prefer-called-times](https://lintradar.dev/rules/vitest/prefer-called-times.md): Enforce using `toBeCalledTimes(1)` or `toHaveBeenCalledTimes(1)`
- [vitest/no-duplicate-hooks](https://lintradar.dev/rules/vitest/no-duplicate-hooks.md): Disallow duplicate hooks and teardown hooks
- [vitest/prefer-called-with](https://lintradar.dev/rules/vitest/prefer-called-with.md): Enforce using `toBeCalledWith()` or `toHaveBeenCalledWith()`
- [vitest/max-nested-describe](https://lintradar.dev/rules/vitest/max-nested-describe.md): Require describe block to be less than set max value or default value

---

Web page: https://lintradar.dev/rules/vitest/no-test-return-statement. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
