Files
cultivation-world-simulator/web/src/__tests__/setup.ts
Zihao Xu 8bf5f64bc3 test(web): setup frontend test infrastructure (#60)
- 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
2026-01-19 20:48:28 +08:00

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()
})