# jest-mock-canvas-to-blob

> DEPRECATED See (https://github.com/hustcc/jest-canvas-mock/issues). A module to mock canvas in Jest.

Latest version **1.0.1** (published 2019-01-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install jest-mock-canvas-to-blob
pnpm add jest-mock-canvas-to-blob
yarn add jest-mock-canvas-to-blob
bun add jest-mock-canvas-to-blob
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-01-30 |
| First published | 2019-01-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | hustcc |
| Maintainers | adriarios |
| Keywords | mock, jest, jest-mock, echarts, canvas, test, unit |

## Links

- npm: https://www.npmjs.com/package/jest-mock-canvas-to-blob
- Repository: https://github.com/hustcc/jest-canvas-mock
- Homepage: https://github.com/hustcc/jest-canvas-mock#readme
- Issues: https://github.com/hustcc/jest-canvas-mock/issues
- npm.io page: https://npm.io/package/jest-mock-canvas-to-blob

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-01-30
- 1.0.0 — 2019-01-30

## README

# jest-canvas-mock

> Mock `canvas` when run unit test cases with jest. [Reference](https://github.com/Cristy94/canvas-mock/issues/2).

[![Build Status](https://travis-ci.org/hustcc/jest-canvas-mock.svg?branch=master)](https://travis-ci.org/hustcc/jest-canvas-mock)
[![Coverage Status](https://coveralls.io/repos/github/hustcc/jest-canvas-mock/badge.svg?branch=master)](https://coveralls.io/github/hustcc/jest-canvas-mock)
[![npm](https://img.shields.io/npm/v/jest-canvas-mock.svg)](https://www.npmjs.com/package/jest-canvas-mock)
[![npm](https://img.shields.io/npm/dm/jest-canvas-mock.svg)](https://www.npmjs.com/package/jest-canvas-mock)


## Install

This should only be installed as a development dependency (`devDependencies`) as it is only designed for testing.

```bash
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.

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

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

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

More about in [configuration section](https://facebook.github.io/jest/docs/en/configuration.html#content).


## 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`

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

Add that file to your `setupFiles` array:

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


## License

MIT@[hustcc](https://github.com/hustcc).

---
_Source: https://npm.io/package/jest-mock-canvas-to-blob · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
