noExcessiveNestedTestSuites
Este conteúdo não está disponível em sua língua ainda.
Diagnostic Category: lint/complexity/noExcessiveNestedTestSuites
Since: v1.6.0
Sources:
- Same as:
jest/max-nested-describe
This rule enforces a maximum depth to nested describe()
in test files.
To improve code clarity in your tests, the rule limits nested describe
to 5.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.js:6:11 lint/complexity/noExcessiveNestedTestSuites ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Excessive describe()
nesting detected.
4 │ describe(‘qux’, () => {
5 │ describe(‘quxx’, () => {
> 6 │ describe(‘too many’, () => {
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 7 │ it(‘should get something’, () => {
> 8 │ expect(getSomething()).toBe(‘Something’);
> 9 │ });
> 10 │ });
│ ^^
11 │ });
12 │ });
ℹ Excessive nesting of describe() calls can hinder test readability.
ℹ Consider refactoring and reduce the level of nested describe to improve code clarity.