SKILL.md
readonlyread-only
name
vue-testing-best-practices
description
用於 Vue.js 測試。涵蓋 Vitest、Vue Test Utils、元件測試、模擬、測試模式,以及使用 Playwright 進行端到端測試。
version
1.0.0
Vue.js 測試最佳實踐、模式與常見陷阱。
測試
- 為 Vue 3 專案設定測試基礎架構 → 請參閱 testing-vitest-recommended-for-vue
- 重構元件內部時測試一直失敗 → 請參閱 testing-component-blackbox-approach
- 測試因競爭條件而間歇性失敗 → 請參閱 testing-async-await-flushpromises
- 使用生命週期鉤子或 inject 的組合式函式無法測試 → 請參閱 testing-composables-helper-wrapper
- 測試中出現「injection Symbol(pinia) not found」錯誤 → 請參閱 testing-pinia-store-setup
- 具有非同步設定的元件在測試中無法渲染 → 請參閱 testing-suspense-async-components
- 快照測試在功能已損壞時仍持續通過 → 請參閱 testing-no-snapshot-only
- 為 Vue 應用程式選擇端到端測試框架 → 請參閱 testing-e2e-playwright-recommended
- 測試需要驗算計算樣式或真實 DOM 事件 → 請參閱 testing-browser-vs-node-runners
- 測試使用 defineAsyncComponent 建立的元件失敗 → 請參閱 async-component-testing
- 傳送的模態內容在 wrapper 查詢中找不到 → 請參閱 teleport-testing-complexity






