jest-serializer-vue

A jest serializer for Vue snapshots

MIT 9 个版本
安装
npm install jest-serializer-vue
yarn add jest-serializer-vue
pnpm add jest-serializer-vue
bun add jest-serializer-vue
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()
  })
})
版本列表
3.1.0 2022-11-18
3.0.0 2022-11-18
2.0.2 2018-06-05
2.0.1 2018-06-04
2.0.0 2018-05-29
1.0.0 2018-03-08
0.3.0 2017-11-07
0.2.0 2017-09-19
0.1.0 2017-09-08