|
před 2 roky | |
---|---|---|
.. | ||
.circleci | před 2 roky | |
test | před 2 roky | |
.babelrc | před 2 roky | |
.eslintrc | před 2 roky | |
CHANGELOG.md | před 2 roky | |
LICENSE | před 2 roky | |
README.md | před 2 roky | |
index.js | před 2 roky | |
jest.config.json | před 2 roky | |
package.json | před 2 roky |
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()
})
})