caoge c760052ff9 机车状态修改 | hai 8 meses | |
---|---|---|
.. | ||
.circleci | hai 8 meses | |
test | hai 8 meses | |
.babelrc | hai 8 meses | |
.eslintrc | hai 8 meses | |
CHANGELOG.md | hai 8 meses | |
LICENSE | hai 8 meses | |
README.md | hai 8 meses | |
index.js | hai 8 meses | |
jest.config.json | hai 8 meses | |
package.json | hai 8 meses |
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()
})
})