Nesting suites

As a project matures, the unit testing code grows huge and it's difficult to maintain. In such cases, it's good to use nested suites. Consider an example of a company, where employees are classified into several departments such as admin, finance, HR, delivery, presales, and sales. While there can be a common set of specs that apply to all employees, each department may also need some specs for department-specific features. Desk allocation can be task related to admin, while annual prize distribution can be a part of HR. Now all these specs can be grouped into suites, and all these suites can be clubbed into one suite for the whole company. We can nest suites by placing a describe block into another describe:

describe("Testing Company ...

Get Test-Driven JavaScript Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.