Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 2.82 KB

A-plugins.md

File metadata and controls

63 lines (47 loc) · 2.82 KB

Plugins

Because testdouble.js, even as a focused test double API, is quite large, we encourage users in the community to consider implementing features as plugins that decorate additional functionality on and around testdouble.js.

If you have an idea for a feature you'd like to see, please open an issue to start a discussion on the best place for that feature to live (in the core library or as a plugin).

Assertion Plugins

As discussed elsewhere, testdouble.js is written to be test-library-agnostic. In order to use the library in your test suite, you don't need a custom plugin for your preferred testing framework. However, it may be the case that you'd prefer to bridge the verify() method of testdouble.js with your preferred assertion API for aesthetic or error-handling reasons.

These plugins developed by ourselves & the community:

Module Replacement Plugins

Some testing frameworks have built-in module replacement systems for injecting fakes into your tests. Depending on the framework and your configuration, you may need a plugin to use replace() / replaceEsm() in your tests:

Build Plugins

Sometimes, it can be handy to have a ready-made shim to pull in and configure the library for various build tools. Here's what testdouble.js has so far:

Fake Timers

One popular feature of Sinon.js is its fake timer API, which can be used to synchronously test code that should defer execution for a certain amount of time (for instance, when testing that a component debounces user input).

This API has been ported for use with testdouble.js by @kuy as testdouble-timers.


Previous: Debugging with testdouble.js Next: Frequently Asked Questions