eddyerburgh / jest-serializer-vue

Jest Serializer for Vue components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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()
  })
})

About

Jest Serializer for Vue components

License:MIT License


Languages

Language:JavaScript 69.1%Language:Vue 30.9%