I have default jest.config.js but when i want run unit test i get an error message:
Validation Error: Preset @vue/cli-plugin-unit-jest/presets/typescript-and-babel not found.
I am using vue 2 with composition api plugin and typescript.
jest.config.js:
module.exports = {
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel'
}
example.spec.ts:
import { shallowMount } from '@vue/test-utils'
import HelloWorld from '@/components/HelloWorld.vue'
describe('HelloWorld.vue', () => {
it('renders props.msg when passed', () => {
const msg = 'new message'
const wrapper = shallowMount(HelloWorld, {
props: { msg }
})
expect(wrapper.text()).toMatch(msg)
})
})