close

no-focused-tests

Added in v0.8.1

Configuration

PresetConfigured Value
✅ rstestPlugin.configs.recommended"error"
rslint.config.ts
import { defineConfig, rstestPlugin } from '@rslint/core';

export default defineConfig([
  rstestPlugin.configs.recommended,
  {
    rules: {
      'rstest/no-focused-tests': 'error',
    },
  },
]);

Rule Details

Disallow focused Rstest tests and describe blocks. The rule reports an explicit .only in a test or suite registration, including conditional, parameterized, and extended test APIs.

The rule recognizes Rstest globals, @rstest/core, import.meta.rstest, and @rstest/playwright. It follows same-file const aliases, including aliases that store an already-focused API.

The rule provides a suggestion that removes every .only contributing to the registration. Suggestions preserve comments and optional-chain boundaries.

Examples of incorrect code for this rule:

import { describe, test } from '@rstest/core';

test.only('adds two numbers', () => {});
describe.only('math', () => {});
test.concurrent.only('runs concurrently', () => {});
test.only.for([1, 2])('handles %s', () => {});
test.extend({ database }).only('uses a database', () => {});

const focused = test.only;
focused('focused through an alias', () => {});

import.meta.rstest.test.only('in-source test', () => {});

Examples of correct code for this rule:

import { describe, test } from '@rstest/core';

test('adds two numbers', () => {});
describe('math', () => {});
test.concurrent('runs concurrently', () => {});
test.extend({ database })('uses a database', () => {});

Rstest does not expose Jest's fit or fdescribe aliases, so this rule does not treat those names as Rstest registrations.

References