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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.