Nebulous Puffy Marshmallows
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

jest-mock-canvas-to-blob

1.0.1 • Public • Published

jest-canvas-mock

Mock canvas when run unit test cases with jest. Reference.

Build Status Coverage Status npm npm

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.

{
  "jest": {
    "setupFiles": ["jest-canvas-mock"]
  }
}

If you already have a setupFiles attribute you can also append jest-canvas-mock to the array.

{
  "jest": {
    "setupFiles": ["./__setups__/other.js", "jest-canvas-mock"]
  }
}

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

import 'jest-canvas-mock';
// or
require('jest-canvas-mock');

Add that file to your setupFiles array:

"jest"{
  "setupFiles": [
    "./__setups__/canvas.js"
  ]
}

License

MIT@hustcc.

Install

npm i jest-mock-canvas-to-blob

DownloadsWeekly Downloads

64

Version

1.0.1

License

ISC

Unpacked Size

12.3 kB

Total Files

9

Last publish

Collaborators

  • avatar