Skip to content

eddyerburgh/jest-serializer-vue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

62f8d50 Β· Nov 18, 2022

History

44 Commits
May 3, 2019
Jun 5, 2018
Mar 8, 2018
Sep 8, 2017
Sep 8, 2017
Nov 18, 2022
Oct 24, 2018
Sep 8, 2017
May 3, 2019
Nov 18, 2022
May 24, 2018
Nov 18, 2022
Nov 18, 2022

Repository files navigation

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