hz-zhhq-web/node_modules/jest-serializer-vue
zzyuan 03ac614884 前端提交3 2025-02-25 13:45:28 +08:00
..
.circleci 前端提交3 2025-02-25 13:45:28 +08:00
test 前端提交3 2025-02-25 13:45:28 +08:00
.babelrc 前端提交3 2025-02-25 13:45:28 +08:00
.eslintrc 前端提交3 2025-02-25 13:45:28 +08:00
CHANGELOG.md 前端提交3 2025-02-25 13:45:28 +08:00
LICENSE 前端提交3 2025-02-25 13:45:28 +08:00
README.md 前端提交3 2025-02-25 13:45:28 +08:00
index.js 前端提交3 2025-02-25 13:45:28 +08:00
jest.config.json 前端提交3 2025-02-25 13:45:28 +08:00
package.json 前端提交3 2025-02-25 13:45:28 +08:00

README.md

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 { shallow } from 'avoriaz'
import Basic from './Basic.vue'
import { createRenderer } from 'vue-server-renderer'

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