I am encountering an issue with my default jest.config.js file. When I try to run a unit test, I receive the following error message:
Validation Error: Preset @vue/cli-plugin-unit-jest/presets/typescript-and-babel not found.
The technologies I am using include Vue 2 with the Composition API plugin and TypeScript.
Here is the content of my jest.config.js file:
module.exports = {
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel'
}
And here is an example spec file (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)
})
})