caoge c760052ff9 机车状态修改 | 8 months ago | |
---|---|---|
.. | ||
.circleci | 8 months ago | |
test | 8 months ago | |
.babelrc | 8 months ago | |
.eslintrc | 8 months ago | |
CHANGELOG.md | 8 months ago | |
LICENSE | 8 months ago | |
README.md | 8 months ago | |
index.js | 8 months ago | |
jest.config.json | 8 months ago | |
package.json | 8 months ago |
Jest Vue snapshot serializer
npm install --save-dev jest-serializer-vue
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()
})
})