lihai 8d6c751f49 feat: push 2 years ago
..
.circleci 8d6c751f49 feat: push 2 years ago
test 8d6c751f49 feat: push 2 years ago
.babelrc 8d6c751f49 feat: push 2 years ago
.eslintrc 8d6c751f49 feat: push 2 years ago
CHANGELOG.md 8d6c751f49 feat: push 2 years ago
LICENSE 8d6c751f49 feat: push 2 years ago
README.md 8d6c751f49 feat: push 2 years ago
index.js 8d6c751f49 feat: push 2 years ago
jest.config.json 8d6c751f49 feat: push 2 years ago
package.json 8d6c751f49 feat: push 2 years ago

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