- 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.
28 lines
452 B
TypeScript
28 lines
452 B
TypeScript
/**
|
|
* Expose Vue reactivity and lifecycle on globalThis so that .vue components
|
|
* that rely on Nuxt auto-imports (ref, computed, etc.) work in Vitest.
|
|
*/
|
|
import {
|
|
ref,
|
|
computed,
|
|
reactive,
|
|
watch,
|
|
watchEffect,
|
|
onMounted,
|
|
onUnmounted,
|
|
nextTick,
|
|
readonly,
|
|
} from 'vue'
|
|
|
|
Object.assign(globalThis, {
|
|
ref,
|
|
computed,
|
|
reactive,
|
|
watch,
|
|
watchEffect,
|
|
onMounted,
|
|
onUnmounted,
|
|
nextTick,
|
|
readonly,
|
|
})
|