Vue.js - jest unit test with phpstorm

github @vue/cli-plugin-unit-jest Vue Test Utils unit test를 하기 위한 준비


vue add @vue/unit-jest


"test:unit": "vue-cli-service test:unit"


npm i chai -D


test 코드 작성

wrapper 참고 chai 참고


import { expect } from 'chai'
import { shallowMount } from '@vue/test-utils'
import About from '@/components/About.vue'

describe('About.vue', () => {
  it('renders props.msg when passed', () => {
    const msg = 'new message'
    const wrapper = shallowMount(About, {
      propsData: { msg }
    })
    expect(wrapper.html()).contain('Loremh ipsum')
  })
})


phpstorm 설정