@japa/snapshot
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

@japa/snapshot

Snapshot testing plugin for Japa

gh-workflow-image npm-image license-image

Snapshot testing plugin for Japa. This plugin allows you to write snapshot tests for your application.

Installation

Install the package from the npm registry as follows:

npm i @japa/snapshot

pnpm i @japa/snapshot

yarn add @japa/snapshot

Usage

You can use this package with the @japa/runner as follows.

import { snapshot } from '@japa/snapshot'
import { configure } from '@japa/runner'

configure({
  plugins: [snapshot()],
})

Once done, you will be able to use the 2 new matchers added, either on expect or assert

test('test title', ({ expect, assert }) => {
  // with @japa/assert
  assert.snapshot('1').match()

  // with @japa/expect
  expect('1').toMatchSnapshot()
})

/@japa/snapshot/

    Package Sidebar

    Install

    npm i @japa/snapshot

    Weekly Downloads

    370

    Version

    2.0.5

    License

    MIT

    Unpacked Size

    74.7 kB

    Total Files

    24

    Last publish

    Collaborators

    • romainlanz
    • julien-r44
    • virk