2.5.11 Un-nest JS tests that are four levels deep or more
Related to the audit.
Some JavaScript tests, like _TeamMate.spec.js, are nesting describe instructions in an iteration block.
This decrease the test code readability, and produces longer and sometime truncated test log lines, which may themselves be hard to read.
Inline the tests context and assertions whenever possible. When nesting is required, do not go deeper than three levels down.
Regarding this specific test, using something like a shared example and reusing it for each scenario may increase readability while keeping the code short.
The audit proposes 3 levels max, and I propose to use the same limit as we use for RSpec tests: 4 levels of deepness. If this can be enforced by EsLint, the rule is welcome too.
Edited by Manuel Tancoigne