test: add comprehensive unit tests to double coverage#111
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Review Summary by QodoAdd comprehensive unit tests across 15 spec files to double coverage
WalkthroughsDescription• Comprehensive expansion of unit test coverage across 15 spec files, improving statement coverage from ~27% to ~56% • Key modules now achieve high coverage: color.ts (100%), react/usage.ts (100%), json/deps.ts (100%), react/bindings.ts (97.5%), ascii/import.ts (98%), react/file.ts (97%), react/entries.ts (93%), react/walk.ts (93%), react/symbols.ts (93%), react/references.ts (91%) • Tests use oxc-parser's parseSync to parse real TSX code snippets and validate against actual AST nodes rather than mocking • Added helper factory functions (createGraph, createFileAnalysis, createSymbolFromCode, etc.) for consistent and maintainable test setup • Comprehensive coverage of all branches and logic paths including edge cases, circular references, and error conditions • Note: Low-coverage files (deps/diff.ts, deps/index.ts, react/diff.ts, app/cli.ts) deferred to E2E tests due to git/filesystem operation requirements Diagramflowchart LR
A["Minimal Placeholder Tests<br/>~27% Coverage"] -- "Expand with Real AST Parsing" --> B["Comprehensive Test Suites<br/>~56% Coverage"]
B -- "15 Spec Files" --> C["High Coverage Modules<br/>80-100%"]
C --> D1["React Analysis<br/>usage, file, entries, walk,<br/>symbols, references, bindings"]
C --> D2["Output Formatting<br/>ascii/import, ascii/react,<br/>json/deps, json/react"]
C --> D3["Utilities<br/>color"]
File Changes1. src/analyzers/react/references.spec.ts
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #111 +/- ##
==========================================
+ Coverage 66.13% 69.16% +3.03%
==========================================
Files 39 39
Lines 2640 2640
Branches 873 873
==========================================
+ Hits 1746 1826 +80
+ Misses 525 479 -46
+ Partials 369 335 -34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…g, and pnpm-lock Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…diff Raises unit test statement coverage from 62.7% to 81.9%. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
color.ts(100%),react/usage.ts(100%),json/deps.ts(100%),react/bindings.ts(97.5%),ascii/import.ts(98%),react/file.ts(97%),react/entries.ts(93%),react/walk.ts(93%),react/symbols.ts(93%),react/references.ts(91%).oxc-parser'sparseSyncto parse real TSX code snippets and validate against actual AST nodes rather than mocking.Related Issue
N/A
Validation
pnpm run checkcodex/issue-<number>-<slug>devNotes
deps/diff.ts,deps/index.ts,react/diff.ts,app/cli.ts) require real git/filesystem operations and are better suited for E2E tests.