

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# Project: Vitest Unit Testing Framework23## Framework Structure4- Use Vitest as the primary test runner for Vite-based projects5- Organize tests alongside source files or in dedicated __tests__ directories6- Use TypeScript for type-safe test implementations7- Leverage Vite's native ESM support for fast test execution89## Coding Standards10- Follow JavaScript/TypeScript best practices11- Use meaningful test and variable naming12- Implement clean code principles13- Limit describe block nesting to 3 levels maximum1415## Test Organization16- Group related tests using describe blocks17- Use it/test functions for individual test cases18- Implement beforeEach/afterEach for setup and teardown19- Separate unit, integration, and component tests into distinct directories2021## Best Practices22- Follow Arrange-Act-Assert (AAA) pattern23- Write focused, single-responsibility tests24- Avoid test interdependencies and shared mutable state25- Use vi.fn() for mocking instead of manual mocks26- Leverage in-source testing for utility functions when appropriate2728## Mocking Strategies29- Use vi.mock() for module-level mocking30- Implement vi.spyOn() for method-level spying31- Use vi.useFakeTimers() for time-dependent tests32- Mock HTTP requests with msw (Mock Service Worker) or vi.mock()33- Restore mocks after each test with vi.restoreAllMocks()3435## Assertions36- Use expect() with specific, descriptive matchers37- Implement custom matchers for domain-specific assertions38- Use toMatchSnapshot() for stable UI component output testing39- Prefer toEqual for deep equality over toBe for object comparisons4041## Coverage42- Configure coverage with v8 or istanbul provider43- Set meaningful coverage thresholds (statements, branches, functions, lines)44- Use exclude patterns for generated or non-testable code45- Generate HTML reports for local visualization4647## Performance48- Use it.concurrent for independent parallel tests49- Implement proper test isolation to enable safe parallel execution50- Minimize unnecessary setup/teardown operations51- Configure poolOptions for optimal worker usage5253## Component Testing54- Use @vitest/browser for browser-based component tests55- Integrate with Testing Library (@testing-library/vue, /react, /svelte) for user-centric assertions56- Mock child components only when testing in isolation is critical57- Snapshot test stable, presentational components5859## Test Data Management60- Use factory functions or fixtures for reusable test data61- Define TypeScript types for all test data structures62- Avoid hardcoded magic values; use named constants63- Generate dynamic or random data with @faker-js/faker when needed6465## CI/CD Integration66- Configure reporters for CI environments (--reporter=verbose or junit)67- Use --reporter=junit for CI pipeline compatibility68- Enable test result caching with vitest cache69- Upload coverage reports to services like Codecov or SonarQube7071## Environment Configuration72- Use environment-specific vitest.config files73- Configure test globals (describe, it, expect) via globals: true74- Handle environment variables with dotenv integration75- Use setupFiles for global test setup and teardown logic7677## Error Handling78- Test both success and failure code paths79- Assert on specific error messages and types80- Use expect().rejects for async error assertions81- Implement retry logic tests for flaky network operations8283## Documentation84- Document complex test scenarios with brief inline comments85- Maintain a test helper and fixture README86- Include examples for custom matchers87- Document project-specific mock strategies8889Remember to leverage Vitest's native Vite integration and HMR-based watch mode for fast, reliable unit testing.90
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| tugkanboz/awesome-cursorrulesexample-structures/cypress/.cursor/rules/testing-fundamentals.mdc · 19 | Cursor rules | testarchtesting-strategysecurity+2 | 62/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesexample-structures/selenium-python/.cursor/rules/page-object-patterns.mdc · 19 | Cursor rules | ui | 54/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesexample-structures/cypress/.cursor/rules/api-testing.mdc · 19 | Cursor rules | testtesting-strategyapi | 58/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesexample-structures/next-js/.cursor/rules/app-router-patterns.mdc · 19 | Cursor rules | styleapido-not | 65/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesexample-structures/react-typescript/.cursor/rules/component-development.mdc · 19 | Cursor rules | teststylearchtypes+1 | 58/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesexample-structures/selenium-python/.cursor/rules/framework-architecture.mdc · 19 | Cursor rules | setuptestlint-formatstyle+3 | 93/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesframeworks/cypress/.cursor/rules/cypress-excellence.mdc · 19 | Cursor rules | testtesting-strategysecurityperformance+1 | 58/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesrules/appium-mobile-test-automation-framework/.cursorrules · 19 | .cursorrules | teststylearchperformance+2 | 56/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesrules/cypress-javascript-test-automation-framework/.cursorrules · 19 | .cursorrules | testlint-formatstylearch+4 | 59/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesrules/k6-performance-test-framework/.cursorrules · 19 | .cursorrules | setupteststylearch+2 | 56/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesrules/playwright-javascript-test-automation-framework/.cursorrules · 19 | .cursorrules | testlint-formatstylearch+3 | 59/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesrules/selenium-net-test-automation-framework/.cursorrules · 19 | .cursorrules | teststylearchdeployment+1 | 56/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesrules/selenium-python-test-automation-framework/.cursorrules · 19 | .cursorrules | testlint-formatstylearch+3 | 59/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesrules/webdriverio-javascript-test-automation-framework/.cursorrules · 19 | .cursorrules | testlint-formatstylearch+4 | 69/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesrules/restassured-java-framework/.cursorrules · 19 | .cursorrules | teststylearchsecurity+4 | 56/100 | 13 days ago | |
| tugkanboz/awesome-cursorrulesexample-structures/selenium-python/.cursor/rules/test-patterns.mdc · 19 | Cursor rules | teststylearchtesting-strategy+1 | 66/100 | 13 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/tugkanboz-awesome-cursorrules-rules-vitest-javascript-unit-test-framework-cursorrules)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.