travel/admin/node_modules/jest-serializer-vue
yaosen 242417d45d init... 2024-06-24 11:28:18 +08:00
..
.circleci init... 2024-06-24 11:28:18 +08:00
test init... 2024-06-24 11:28:18 +08:00
.babelrc init... 2024-06-24 11:28:18 +08:00
.eslintrc init... 2024-06-24 11:28:18 +08:00
CHANGELOG.md init... 2024-06-24 11:28:18 +08:00
LICENSE init... 2024-06-24 11:28:18 +08:00
README.md init... 2024-06-24 11:28:18 +08:00
index.js init... 2024-06-24 11:28:18 +08:00
jest.config.json init... 2024-06-24 11:28:18 +08:00
package.json init... 2024-06-24 11:28:18 +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()
  })
})