1. jest-serializer-vue
A jest serializer for Vue snapshots
jest-serializer-vue
Package: jest-serializer-vue
Created by: eddyerburgh
Last modified: Fri, 18 Nov 2022 21:37:54 GMT
Version: 3.1.0
License: MIT
Downloads: 1,686,419
Repository: https://github.com/eddyerburgh/jest-serializer-vue

Install

npm install jest-serializer-vue
yarn add jest-serializer-vue

jest-serializer-vue

Jest Vue snapshot serializer

Installation

npm install --save-dev jest-serializer-vue

Usage

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 { shallowMount } from '@vue/test-utils'
import Basic from './Basic.vue'

describe('Basic.vue', () => {
  it('renders correctly', () => {
    const wrapper = shallowMount(Basic)
    expect(wrapper).toMatchSnapshot()
  })
})

Dependencies

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin