- Add testing dependencies (vitest, vue-test-utils, testing-library, jsdom, msw) - Create vitest.config.ts with jsdom environment and coverage settings - Create setup.ts with Pinia initialization and fake timers - Add test scripts to package.json (test, test:run, test:coverage) Closes #56, closes #57
16 lines
373 B
TypeScript
16 lines
373 B
TypeScript
import { vi, beforeEach, afterEach, beforeAll, afterAll } from 'vitest'
|
|
import { createPinia, setActivePinia } from 'pinia'
|
|
|
|
// Use fake timers globally for consistent async testing.
|
|
vi.useFakeTimers()
|
|
|
|
// Setup fresh Pinia instance for each test.
|
|
beforeEach(() => {
|
|
setActivePinia(createPinia())
|
|
})
|
|
|
|
// Cleanup after each test.
|
|
afterEach(() => {
|
|
vi.clearAllMocks()
|
|
})
|