jest-canvas-mock
Mock
canvas
when run unit test cases with jest. Reference.
Install
This should only be installed as a development dependency (devDependencies
) as it is only designed for testing.
npm i --save-dev jest-canvas-mock
Setup
In your package.json
under the jest
, create a setupFiles
array and add jest-canvas-mock
to the array.
If you already have a setupFiles
attribute you can also append jest-canvas-mock
to the array.
More about in configuration section.
Setup file
Alternatively you can create a new setup file which then requires this module or
add the require
statement to an existing setup file.
__setups__/canvas.js
;// or;
Add that file to your setupFiles
array:
"jest":
License
MIT@hustcc.