Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

jest-serializer-vue

eddyerburgh1.7mMIT3.1.0

A jest serializer for Vue snapshots

jest

readme

jest-serializer-vue

Jest Vue snapshot serializer

Installation

npm install --save-dev jest-serializer-vue

Usage

You need to tell Jest to use the serializer. Add this to your Jest config:

"snapshotSerializers": [
  "<rootDir>/node_modules/jest-serializer-vue"
]

And your snapshot tests will be pretty printed 💅

import { shallowMount } from '@vue/test-utils'
import Basic from './Basic.vue'

describe('Basic.vue', () => {
  it('renders correctly', () => {
    const wrapper = shallowMount(Basic)
    expect(wrapper).toMatchSnapshot()
  })
})

changelog

v2.0.1 (2018-06-04)

Bug Fixes

  • Ensure that recieved is not null | undefined (#6) (69b2553)

v2.0.0 (2018-05-29)

Features

  • serialize Wrapper Instances (#4) 3e8dec0. Create a snapshot with a Vue Test Utils Wrapper instance. This means you no longer need to call .html() on your Wrapper instance before calling toMatchSnapshot().

v1.0.0 (2018-03-09)

Features

  • Change indentation to two spaces (b193932)

v0.3.0 (2017-11-07)

Bug Fixes

  • add missing js-beautify dependency 8ae7304
  • indentation issues (#1) b193932

v0.2.0 (2017-09-19)

Bug Fixes

  • add missing js-beautify dependency (8ae7304)

v0.1.0 (2017-09-08)

Initial release