close

padding-around-expect-groups

Added in v0.9.2

Configuration

rslint.config.ts
import { defineConfig, jestPlugin } from '@rslint/core';

export default defineConfig([
  jestPlugin.configs.recommended,
  {
    rules: {
      'jest/padding-around-expect-groups': 'error',
    },
  },
]);

Rule Details

Require a blank line around each consecutive group of expect statements. Adjacent assertions remain together without blank lines between them. Awaited expect statements are included.

Incorrect

const account = loadAccount();
expect(account.name).toBe('Ada');
expect(account.active).toBe(true);
saveAccount(account);

Correct

const account = loadAccount();

expect(account.name).toBe('Ada');
expect(account.active).toBe(true);

saveAccount(account);

Autofix

The rule inserts missing blank lines at assertion-group boundaries.

Original Documentation