zaqqaz / jest-image

🌇vs 🌆Custom jest matchers to test the visual regression

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jest-image 🌇 vs 🌆

Blazing fast custom jest matchers to test the visual regression 🔥🚀

CircleCI License: MIT PRs Welcome

GitHub followers GitHub stars GitHub watchers

Installation

This module is distributed via [npm][npm] which is bundled with [node][node] and should be installed as one of your project's devDependencies:

npm install --save-dev jest-image

or

yarn add --D jest-image

Usage

Import jest-image/extend-expect once (for instance in your tests setup file) and you're good to go:

import 'jest-image/extend-expect'

Alternatively, you can selectively import only the matchers you intend to use, and extend jest's expect yourself:

import { toMatchImageBuffer } from 'jest-image'

expect.extend({ toMatchImageBuffer })

toMatchImageSnapshot

toMatchImageSnapshot(buffer: Buffer)

Example.

The most powerful way to compare image snapshots.

  • Add more examples

toMatchImageBuffer

toMatchImageBuffer(buffer: Buffer)

Example.

It's the fastest way to compare images.

It takes less than 1ms to get a result.

toMatchMarkupToImageSnapshot

toMatchMarkupToImageSnapshot(html: string)
  • Implement me.

  • Add documentation.

About

🌇vs 🌆Custom jest matchers to test the visual regression

License:MIT License


Languages

Language:TypeScript 99.4%Language:JavaScript 0.6%