0.3.3 • Published 2 years ago

vitest-canvas-mock v0.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vitest-canvas-mock

npm (tag) npm bundle size NPM

Mock canvas when running unit tests with vitest. Uses jest-canvas-mock.

Install

npm install vitest-canvas-mock -D

Usage

  1. Create a new setup file that imports vitest-canvas-mock or add it to an existing setup file.
// vitest.setup.ts
import 'vitest-canvas-mock'
  1. In your vitest.config.ts file, create a setupFiles array and add that file:
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    setupFiles: ['./vitest.setup.ts'],
    environment: 'jsdom',
    deps: {
      inline: ['vitest-canvas-mock'],
    },
    // For this config, check https://github.com/vitest-dev/vitest/issues/740
    threads: false,
    environmentOptions: {
      jsdom: {
        resources: 'usable',
      },
    },
  },
})

Mock Strategy

View mock strategy doc here.

Snapshots

View snapshots doc here

License

MIT

0.3.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.3

2 years ago

0.2.1

3 years ago

0.2.2

3 years ago

0.2.0

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago