Spies

Spies are a feature provided by some testing frameworks. They allow us to wrap a method or function and record its usage. We can record things such as the method or function arguments, their return type, or the number of times that they have been invoked. When we wrap a method or function with a spy, the underlying method's functionality does not change.

Get Learning TypeScript 2.x - Second Edition 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.