jest-serializer-vue

2018-12-08 admin

jest-serializer-vue是什么

什么是jest-serializer-vue,A jest serializer for Vue snapshots

jest-serializer-vue使用教程帮助文档

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 <g-emoji class=“g-emoji” alias=“nail_care” fallback-src=“https://assets-cdn.github.com/images/icons/emoji/unicode/1f485.png”>💅</g-emoji>

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

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

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-47601.html

文章标题:jest-serializer-vue

回到顶部