Commit 2950d9a
committed
test: add automated testing framework with Vitest
Add comprehensive testing infrastructure:
**Testing Framework:**
- Add Vitest as test runner (fast, TypeScript-friendly, ESM support)
- Add @vitest/coverage-v8 for code coverage reports
- Add @vitest/ui for interactive test UI
- Configure vitest.config.ts with proper paths and coverage settings
**Unit Tests:**
- Add tests/unit/linear-service-cycles.test.ts (14 tests)
- Test getCycles(), getCycleById(), resolveCycleId() methods
- Use mocks to avoid API calls
- Verify PR czottmann#4 cycle methods work correctly
**Integration Tests:**
- Add tests/integration/cycles-cli.test.ts (8 tests)
- Add tests/integration/project-milestones-cli.test.ts (5 tests)
- Test end-to-end CLI functionality
- Verify no "query too complex" errors (main bug fix)
- Test all command flags and JSON output structure
- Auto-skip if LINEAR_API_TOKEN not set
**Command Coverage Tool:**
- Add tests/command-coverage.ts for CLI-specific coverage analysis
- Shows which commands have integration tests (more relevant than code coverage)
- Automatically discovers new commands and tests
- Reports: 35% of commands tested (cycles and project-milestones fully covered)
**CI/CD:**
- Add .github/workflows/ci.yml for automated testing
- Run tests on every push and PR
- Separate jobs for testing and linting
- Optional integration tests if LINEAR_API_TOKEN secret configured
**Scripts:**
- pnpm test - Run all tests
- pnpm test:watch - Run tests in watch mode
- pnpm test:ui - Run tests with UI
- pnpm test:coverage - Generate code coverage report
- pnpm test:commands - Show command coverage report
**Test Results:**
- All 27 tests passing
- Unit tests: 14 passed (instant, no API)
- Integration tests: 13 passed (~15 seconds with API)
- Command coverage: 35% (7/20 commands tested)
- Cycles and project-milestones commands fully covered
This establishes automated testing practices for the linearis project
and prevents regressions in PR czottmann#4 fixes.1 parent bb273d3 commit 2950d9a
File tree
8 files changed
+2449
-26
lines changed- .github/workflows
- tests
- integration
- unit
8 files changed
+2449
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
31 | | - | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | | - | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
0 commit comments