Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 891 Bytes

no-mixed-expectation-groups.md

File metadata and controls

39 lines (27 loc) · 891 Bytes

Disallow mixing expectations for different variables between each other (proper-tests/no-mixed-expectation-groups)

💼 This rule is enabled in the ✅ recommended config.

Rule details

This rule disallows mixing expectations for different variables between each other.

The following patterns are considered errors:

// example 1
expect(foo).toBeDefined();
expect(bar).toBeNull();
expect(foo).toHaveLength(3); // should be placed before "bar"

// example 1
expect(foo).toBeDefined();
expect(bar).toBeNull();
expect(foo.bars).toHaveLength(3); // should be placed before "bar"

The following patterns are considered correct:

// example 1
expect(foo).toBeDefined();
expect(foo).toHaveLength(3);

expect(bar).toBeNull();

// example 2
expect(foo).toBeDefined();
expect(foo.bars).toHaveLength(3);

expect(bar).toBeNull();