Skip to content

Commit 2e6360b

Browse files
committed
refactor: Enhance testing guidelines by adding structured testing best practices and emphasizing the use of Vitest
1 parent 7f7d374 commit 2e6360b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/copilot-instructions.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- **Rapid iteration**: Make bold changes to improve the codebase structure
1717
- **Technical debt elimination**: Actively remove code that doesn't serve the current vision
1818
- **Modern tooling**: Always use the latest stable versions and best practices
19+
- **Proper testing over temp scripts**: Use structured test cases (Vitest) instead of creating temporary scripts for testing functionality
1920

2021
## Dogfooding Guidelines
2122

@@ -117,4 +118,27 @@ When working with the `@devlog/web` application, use Playwright MCP tools for co
117118
- Use `mcp_playwright_browser_console_messages` to check for JavaScript errors
118119
- Take screenshots with `mcp_playwright_browser_take_screenshot` for visual debugging
119120
- Check network requests with `mcp_playwright_browser_network_requests`
120-
- Verify element states before interactions using snapshots
121+
- Verify element states before interactions using snapshots
122+
123+
## Testing Best Practices
124+
125+
### 13. Prefer Structured Tests Over Temporary Scripts
126+
- **Use Vitest framework**: Create proper test cases instead of ad-hoc scripts in `scripts/`
127+
- **Avoid temp scripts**: Don't create temporary `.mjs` files for testing functionality
128+
- **Comprehensive test coverage**: Write unit tests, integration tests, and end-to-end tests as needed
129+
- **Maintainable testing**: Tests should be part of the CI/CD pipeline and easily runnable
130+
- **Clean up legacy**: Remove temporary scripts once proper tests are in place
131+
132+
### 14. Test Organization
133+
- **Unit tests**: Test individual functions and classes in isolation
134+
- **Integration tests**: Test interactions between components and external services
135+
- **E2E tests**: Use Playwright MCP tools for web application testing
136+
- **Test data management**: Use proper fixtures and test data setup/teardown
137+
- **Descriptive test names**: Tests should clearly describe what they're validating
138+
139+
### 15. Testing Workflow
140+
1. Identify functionality that needs testing
141+
2. Write appropriate test cases using Vitest
142+
3. Ensure tests can be run with standard npm/pnpm scripts
143+
4. Include tests in CI/CD pipeline
144+
5. Remove any temporary scripts that served the same purpose

0 commit comments

Comments
 (0)