Running Tests
DevDaily uses Vitest for fast, modern testing.Tests run automatically in CI across Node.js versions 18, 20, and 22 on every pull request.
Test Structure
All tests live in thetests/ directory and mirror the source structure:
Test Coverage by Module
Test Coverage by Module
Writing Tests
Test Conventions
1
Place tests in tests/ directory
Create files with
.test.ts suffix2
Use descriptive names
describe and it blocks should clearly explain what’s being tested3
Mock external dependencies
Tests must not require network access, git repos, or API keys
4
Test happy path and edge cases
Cover both successful execution and error scenarios
Basic Test Example
Mocking
Config Mocking
Most tests mock the config module to avoid file system dependencies:Network Request Mocking
For webhook and API tests, stub the globalfetch:
Git Operations Mocking
For tests involving git operations:Testing Best Practices
DO ✓
Test both success and failure paths
Test both success and failure paths
Use descriptive test names
Use descriptive test names
Mock external dependencies
Mock external dependencies
Clear mocks between tests
Clear mocks between tests
DON’T ✗
Coverage Reports
Generate an HTML coverage report:- macOS
- Linux
- Windows
Coverage Configuration
Vitest is configured to generate coverage using v8:When adding new features, aim to maintain or improve test coverage. Every new module in
src/core/ should have a corresponding test file.Quality Checklist
Before submitting a pull request, ensure all checks pass:1
TypeScript compilation
2
Linting
3
Formatting
4
Tests
5
Production build
These same checks run automatically in CI on every pull request across Node.js 18, 20, and 22.
Manual Testing
For changes affecting CLI behavior, manual smoke testing is recommended:1. Build and Link
2. Test in a Real Repository
3. Cleanup
When done, unlink the global command:Debugging Tests
Run a Single Test File
Run Tests Matching a Pattern
Enable Verbose Output
Clear Vitest Cache
If tests behave unexpectedly:Continuous Integration
Tests run automatically on every pull request via GitHub Actions:All checks must pass before a PR can be merged.
Next Steps
Setup Guide
Set up your development environment
Architecture
Understand the project structure
Contributing
Submit your first contribution