Skip to content

jest/padding-around-test-blocks Style

🛠️ An auto-fix is available for this rule.

What it does

This rule enforces a line of padding before and after 1 or more test/it statements

Examples

Examples of incorrect code for this rule:

js
const thing = 123;
test("foo", () => {});
test("bar", () => {});
js
const thing = 123;
it("foo", () => {});
it("bar", () => {});

Examples of correct code for this rule:

js
const thing = 123;

test("foo", () => {});

test("bar", () => {});
js
const thing = 123;

it("foo", () => {});

it("bar", () => {});

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny jest/padding-around-test-blocks --jest-plugin
json
{
  "plugins": ["jest"],
  "rules": {
    "jest/padding-around-test-blocks": "error"
  }
}

References

Released under the MIT License.