SKILL.md
唯讀
名稱
vue-testing-best-practices
描述
適用於 Vue.js 測試。內容涵蓋 Vitest、Vue Test Utils、元件測試、Mock 模擬、測試模式,以及使用 Playwright 進行 E2E 測試。
版本
1.0.0
Vue.js 測試的最佳實踐、模式與常見陷阱。
測試
- 為 Vue 3 專案建立測試基礎架構 → 請參閱 testing-vitest-recommended-for-vue
- 重構元件內部邏輯時測試一直壞掉 → 請參閱 testing-component-blackbox-approach
- 因競態條件(Race conditions)導致測試偶發性失敗 → 請參閱 testing-async-await-flushpromises
- 使用生命週期鉤子(Lifecycle hooks)或 inject 的 Composable 難以測試 → 請參閱 testing-composables-helper-wrapper
- 測試時出現 "injection Symbol(pinia) not found" 錯誤 → 請參閱 testing-pinia-store-setup
- 包含非同步 setup(async setup)的元件在測試中無法渲染 → 請參閱 testing-suspense-async-components
- 功能已損壞,快照測試(Snapshot tests)卻依然通過 → 請參閱 testing-no-snapshot-only
- 為 Vue 應用程式選擇端對端(E2E)測試框架 → 請參閱 testing-e2e-playwright-recommended
- 測試需要驗證計算樣式(Computed styles)或真實 DOM 事件 → 請參閱 testing-browser-vs-node-runners
- 測試使用 defineAsyncComponent 建立的元件時失敗 → 請參閱 async-component-testing
- 在 wrapper 查詢中找不到經由 Teleport 傳送的 Modal 內容 → 請參閱 teleport-testing-complexity






