|
16 | 16 | - **Rapid iteration**: Make bold changes to improve the codebase structure |
17 | 17 | - **Technical debt elimination**: Actively remove code that doesn't serve the current vision |
18 | 18 | - **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 |
19 | 20 |
|
20 | 21 | ## Dogfooding Guidelines |
21 | 22 |
|
@@ -117,4 +118,27 @@ When working with the `@devlog/web` application, use Playwright MCP tools for co |
117 | 118 | - Use `mcp_playwright_browser_console_messages` to check for JavaScript errors |
118 | 119 | - Take screenshots with `mcp_playwright_browser_take_screenshot` for visual debugging |
119 | 120 | - 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