|
|
hai 1 ano | |
|---|---|---|
| .. | ||
| .circleci | hai 1 ano | |
| test | hai 1 ano | |
| .babelrc | hai 1 ano | |
| .eslintrc | hai 1 ano | |
| CHANGELOG.md | hai 1 ano | |
| LICENSE | hai 1 ano | |
| README.md | hai 1 ano | |
| index.js | hai 1 ano | |
| jest.config.json | hai 1 ano | |
| package.json | hai 1 ano | |
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()
})
})