Skip to content

Files

Latest commit

 

History

History
25 lines (19 loc) · 651 Bytes

no-test-prefixes.md

File metadata and controls

25 lines (19 loc) · 651 Bytes

Pattern: Deprecated test prefix

Issue: -

Description

Jest provides two ways to mark tests as focused or skipped: prefixes (f/x) and method modifiers (.only/.skip). Using .only and .skip is preferred for better readability and consistency.

Examples

Example of incorrect code:

fit("focused test", () => {});
xit("skipped test", () => {});
fdescribe("focused suite", () => {});
xdescribe("skipped suite", () => {});

Example of correct code:

test.only("focused test", () => {});
test.skip("skipped test", () => {});
describe.only("focused suite", () => {});
describe.skip("skipped suite", () => {});