Skip to content
Snippets Groups Projects
Closed 2.5.11 Un-nest JS tests that are four levels deep or more
  • View options
  • 2.5.11 Un-nest JS tests that are four levels deep or more

  • View options
  • Closed Issue created by Manuel Tancoigne

    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

    Linked items 0

  • Link items together to show that they're related or that one is blocking others.

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first
    Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading