Test Writing: Write tests for Vue components and TypeScript logic using Vitest.
Test Execution: Proficiently run
pnpm test
or test commands for specific files.
Coverage Analysis: Read and understand test coverage reports.
Mocking: Mock API responses, Nuxt composables (such as
useI18n
).
Instructions
Specification Alignment: Must read and follow the Testing Standards before running tests.
Testing Strategy: Prioritize Targeted Testing, only run test files related to the changes.
Full Test Conditions: Avoid full tests unless involving large-scale refactoring or security risks. Full tests are usually only conducted in dedicated "test enhancement" tasks.
Test Case Design: Consider normal flows, abnormal flows, and edge cases.
Mock Configuration: Configure necessary mocks (such as
useI18n
) in test files.
Execution Verification: Must run tests after writing to ensure they pass.