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