Skip to main content

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 the tests/ directory and mirror the source structure:

Writing Tests

Test Conventions

1

Place tests in tests/ directory

Create files with .test.ts suffix
2

Use descriptive names

describe and it blocks should clearly explain what’s being tested
3

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

Follow the Arrange-Act-Assert pattern for clear, readable tests.

Mocking

Config Mocking

Most tests mock the config module to avoid file system dependencies:

Network Request Mocking

For webhook and API tests, stub the global fetch:

Git Operations Mocking

For tests involving git operations:

Testing Best Practices

DO ✓

DON’T ✗

  • Don’t make real network requests
  • Don’t depend on file system state
  • Don’t rely on specific git repository state
  • Don’t use real API keys or credentials
  • Don’t write tests that depend on execution order

Coverage Reports

Generate an HTML coverage report:

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

Must complete with zero errors
2

Linting

Must complete with zero errors
3

Formatting

All files must be properly formatted
4

Tests

All tests must pass
5

Production build

Build must complete successfully
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:

2. Test in a Real Repository

Use --debug to see the full prompt and context sent to Copilot CLI. Use --no-copy to prevent clipboard writes during testing.

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