- Added Vue plugin to vitest.config.ts for better component testing. - Introduced vitest.setup.ts to expose Vue reactivity and lifecycle methods globally, ensuring compatibility with .vue components. - Updated mock implementations in nuxt-imports.ts to include readonly for improved reactivity handling. - Refactored useMapBookmarks and useToast composables to utilize readonly from Vue for better state management.
26 lines
726 B
TypeScript
26 lines
726 B
TypeScript
import { defineConfig } from 'vitest/config'
|
|
import Vue from '@vitejs/plugin-vue'
|
|
import { resolve } from 'path'
|
|
|
|
export default defineConfig({
|
|
plugins: [Vue()],
|
|
test: {
|
|
environment: 'happy-dom',
|
|
include: ['**/__tests__/**/*.test.ts', '**/*.test.ts'],
|
|
globals: true,
|
|
setupFiles: ['./vitest.setup.ts'],
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'html'],
|
|
include: ['composables/**/*.ts', 'components/**/*.vue', 'lib/**/*.ts'],
|
|
exclude: ['**/*.test.ts', '**/__tests__/**', '**/__mocks__/**'],
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'~': resolve(__dirname, '.'),
|
|
'#imports': resolve(__dirname, './__mocks__/nuxt-imports.ts'),
|
|
},
|
|
},
|
|
})
|