Chapter 4Tactfully Tackle Dependencies

Dependencies arise almost everywhere: when code talks to remote services, read from or write to a file, update the DOM, get the user’s location…the list goes on. Dependencies are like taxes—they provide value but can turn into a burden. Keep them to a minimum. From the automated testing point of view, dependencies are irksome. They can make tests nondeterministic, brittle, slow, and cumbersome—we saw the tip of that iceberg in the previous chapter.

Good design is critical to tackling dependencies. You can use some nice tricks and techniques to decouple and replace the dependencies so that the tests are automated and deterministic, and run fast. In this chapter, you’ll first learn how to remove ...

Get Test-Driving JavaScript Applications 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.