Sinon

We won't be getting into mocking until Chapter 8, What to Know Before Getting Started, but Sinon is the generally preferred mocking library among Mocha + Chai users. Some testing frameworks, such as Jest and Jasmine, come with their own mocking library features, but Mocha does not, and Sinon provides an excellent mocking experience.

To install Sinon into your project, execute the following command:

>npm install sinon

Once installed, you will need to import Sinon before you can use it. Use the following import statement to enable the use of Sinon:

import sinon from ‘sinon’;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.150.231