1. install yarn add -D vitest yarn add -D @vue/test-utils 2. create a file in the root folder #index.test.ts import { expect, test } from 'vitest' test( 'hello vitest' , () => { expect( 1 ).toBe( 2 ) }) or import { describe, expect, test } from 'vitest' import { mount } from '@vue/test-utils' import testComponent from './test.vue' describe( 'vitest test' , () => { test( 'test the rendering' , () => { expect(testComponent).toBeTruthy() const wrapper = mount(testComponent) expect(wrapper.text()).toContain( 'hello' ) expect(wrapper.element).toMatchSnapshot() }) }) 3. change vite.config.ts import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import * as path from 'path' export default defineConfig({ plugins: [vue()], resolve: { alias: { '/@' : path.resolve(__dirname, './src' ), }, },