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, and this page is available as Markdown at https://rslint.rs/rules/rstest/max-nested-describe.md.
close

max-nested-describe

Added in v0.9.3

Configuration

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

export default defineConfig([
  rstestPlugin.configs.recommended,
  {
    rules: {
      'rstest/max-nested-describe': 'error',
    },
  },
]);

Rule Details

Limits the depth of nested describe calls. Shallow suite hierarchies keep test names, reports, and inherited suite setup easier to understand.

The rule recognizes Rstest globals and APIs imported from @rstest/core, rstack/test, and @rstest/playwright, including aliases, namespace and CommonJS imports, import.meta.rstest, Playwright test.describe, parameterized suites, conditional suites, chained suite modifiers, and suite callbacks passed by reference. It does not treat similarly named APIs from other test frameworks or locally shadowed functions as Rstest suites.

Incorrect

describe('checkout', () => {
  describe('signed-in customer', () => {
    describe('saved payment method', () => {
      test('places the order', () => {});
    });
  });
});

Correct

describe('checkout for a signed-in customer', () => {
  describe('saved payment method', () => {
    test('places the order', () => {});
  });
});

Options

{
  "rstest/max-nested-describe": [
    "error",
    {
      "max": 2
    }
  ]
}
OptionTypeDefaultDescription
maxinteger5Set the maximum allowed suite nesting depth.