[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FEMJX6YKSWH2DFD3Z3P14H":3,"skill-same:01M6FEMJX6YKSWH2DFD3Z3P14H":50},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":23,"linkOnly":24,"markdownContent":25,"markdownBody":25,"frontMatter":26,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M6FEMJX6YKSWH2DFD3Z3P14H","vitest",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fvitest\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[5],"2026-11-10 10:12:30",false,"# Vitest Best Practices\n\nComprehensive performance optimization and best practices guide for Vitest testing framework. Contains 44 rules across 8 categories, prioritized by impact to guide test writing, refactoring, and code review.\n\n## When to Apply\n\nReference these guidelines when:\n- Writing new Vitest tests\n- Debugging flaky or slow tests\n- Setting up test configuration\n- Reviewing test code in PRs\n- Migrating from Jest to Vitest\n- Optimizing CI\u002FCD test performance\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | Async Patterns | CRITICAL | `async-` |\n| 2 | Test Setup & Isolation | CRITICAL | `setup-` |\n| 3 | Mocking Patterns | HIGH | `mock-` |\n| 4 | Performance | HIGH | `perf-` |\n| 5 | Snapshot Testing | MEDIUM | `snap-` |\n| 6 | Environment | MEDIUM | `env-` |\n| 7 | Assertions | LOW-MEDIUM | `assert-` |\n| 8 | Test Organization | LOW | `org-` |\n\n## Quick Reference\n\n### 1. Async Patterns (CRITICAL)\n\n- `async-await-assertions` - Await async assertions to prevent false positives\n- `async-return-promises` - Return promises from test functions\n- `async-fake-timers` - Use fake timers for time-dependent code\n- `async-waitfor-polling` - Use vi.waitFor for async conditions\n- `async-concurrent-expect` - Use test context expect in concurrent tests\n- `async-act-wrapper` - Await user events to avoid act warnings\n- `async-error-handling` - Test async error handling properly\n\n### 2. Test Setup & Isolation (CRITICAL)\n\n- `setup-beforeeach-cleanup` - Clean up state in afterEach hooks\n- `setup-restore-mocks` - Restore mocks after each test\n- `setup-avoid-shared-state` - Avoid shared mutable state between tests\n- `setup-beforeall-expensive` - Use beforeAll for expensive one-time setup\n- `setup-reset-modules` - Reset modules when testing module state\n- `setup-test-factories` - Use test factories for complex test data\n\n### 3. Mocking Patterns (HIGH)\n\n- `mock-vi-mock-hoisting` - Understand vi.mock hoisting behavior\n- `mock-spyon-vs-mock` - Choose vi.spyOn vs vi.mock appropriately\n- `mock-implementation-not-value` - Use mockImplementation for dynamic mocks\n- `mock-msw-network` - Use MSW for network request mocking\n- `mock-avoid-overmocking` - Avoid over-mocking\n- `mock-type-safety` - Maintain type safety in mocks\n- `mock-clear-between-tests` - Clear mock state between tests\n\n### 4. Performance (HIGH)\n\n- `perf-pool-selection` - Choose the right pool for performance\n- `perf-disable-isolation` - Disable test isolation when safe\n- `perf-happy-dom` - Use happy-dom over jsdom when possible\n- `perf-sharding` - Use sharding for CI parallelization\n- `perf-run-mode-ci` - Use run mode in CI environments\n- `perf-bail-fast-fail` - Use bail for fast failure in CI\n\n### 5. Snapshot Testing (MEDIUM)\n\n- `snap-inline-over-file` - Prefer inline snapshots for small values\n- `snap-avoid-large` - Avoid large snapshots\n- `snap-stable-serialization` - Ensure stable snapshot serialization\n- `snap-review-updates` - Review snapshot updates before committing\n- `snap-describe-intent` - Name snapshot tests descriptively\n\n### 6. Environment (MEDIUM)\n\n- `env-per-file-override` - Override environment per file when needed\n- `env-setup-files` - Use setup files for global configuration\n- `env-globals-config` - Configure globals consistently\n- `env-browser-api-mocking` - Mock browser APIs not available in test environment\n\n### 7. Assertions (LOW-MEDIUM)\n\n- `assert-specific-matchers` - Use specific matchers over generic ones\n- `assert-edge-cases` - Test edge cases and boundaries\n- `assert-one-assertion-concept` - Test one concept per test\n- `assert-expect-assertions` - Use expect.assertions for async tests\n- `assert-toequal-vs-tobe` - Choose toBe vs toEqual correctly\n\n### 8. Test Organization (LOW)\n\n- `org-file-colocation` - Colocate test files with source files\n- `org-describe-nesting` - Use describe blocks for logical grouping\n- `org-test-naming` - Write descriptive test names\n- `org-test-skip-only` - Use skip and only appropriately\n\n## How to Use\n\nRead individual reference files for detailed explanations and code examples:\n\n- [Section definitions](references\u002F_sections.md) - Category structure and impact levels\n- [Rule template](assets\u002Ftemplates\u002F_template.md) - Template for adding new rules\n- [async-await-assertions](references\u002Fasync-await-assertions.md) - Example rule file\n- [mock-vi-mock-hoisting](references\u002Fmock-vi-mock-hoisting.md) - Example rule file\n\n## Related Skills\n\n- For TDD methodology, see `test-tdd` skill\n- For API mocking with MSW, see `test-msw` skill\n- For TypeScript testing patterns, see `typescript` skill\n\n## Full Compiled Document\n\nFor the complete guide with all rules expanded: `AGENTS.md`\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fpproenca\u002Fdot-skills\u002Fvitest",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill vitest",{"tool":42,"command":43},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill vitest",{"tool":45,"command":46},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill vitest","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fvitest\u002FSKILL.md",true,[],[51,63,73,82,88,95],{"skillNo":52,"name":53,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":59,"publishedAt":23},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[56],{"categoryNo":57,"categoryName":58,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[60,61,62],"model","model hierarchy","model hierarchy skill",{"skillNo":64,"name":65,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":69,"publishedAt":23},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[68],{"categoryNo":57,"categoryName":58,"taxonomyType":20,"taxonomyTypeDesc":21},[70,71,72],"MCP","zoom","zoom mcp",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":23},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[79,80,81,71],"sdk","zoom apps sdk","apps",{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":23},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[84],{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":94,"publishedAt":23},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[93],{"categoryNo":57,"categoryName":58,"taxonomyType":20,"taxonomyTypeDesc":21},[90],{"skillNo":96,"name":97,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":23},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[97]]