You just have to specify the aliases in your vitest.config.js
file:
import path from 'path'
import vue from '@vitejs/plugin-vue'
export default {
plugins: [vue()],
test: {
globals: true,
environment: 'jsdom',
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
},
},
}