A systematic test suite to verify codescope's feature coverage and accuracy.
# Build the project
cd ..
cargo build --release
# Run tests
cd test-suite
./run-tests.sh
# View results
cat TEST_RESULTS.md
cat FINDINGS.mdTests arrow function detection (most common pattern in modern React/TypeScript)
Expected: 5 arrow functions Actual: 0 ❌ Status: Not supported
Tests standard function declarations (traditional TypeScript pattern)
Expected: 5 functions Actual: 6 ✅ (includes nested function) Status: Mostly supported, complexity accurate
Tests class method detection (OOP pattern)
Expected: 1 class + 7 methods Actual: 1 class, 0 methods ❌ Status: Only detects class, not methods
Tests function expressions (including IIFE)
Expected: 5 function expressions Actual: 0 ❌ Status: Not supported
Tests edge cases and complex scenarios
Expected: 4 functions (mixed patterns)
Actual: 1
- Standard function declarations (
function foo() {}) - Type definitions (type, interface, enum)
- Class declarations (class)
- Cyclomatic complexity calculation (for detected functions)
- File-level metrics (LOC, coupling)
- Arrow functions (
const foo = () => {}) - Affects 70-80% of modern projects - Function expressions (
const foo = function() {}) - Class methods (including constructor, getter, static)
- Object methods
- Nested functions (sometimes detected)
- Function declarations in complex files (may be missed)
- Logical operator complexity counting (occasionally off by ±1)
| Project Type | Function Detection | File Metrics | Overall Usability |
|---|---|---|---|
| Traditional TypeScript (function) | 80-90% | 90% | ⭐⭐⭐⭐ |
| Modern React/TS (arrow) | 20-30% | 90% | ⭐⭐ |
| OOP (class methods) | 0% | 90% | ⭐⭐ |
| Mixed Projects | 40-60% | 90% | ⭐⭐⭐ |
- TEST_RESULTS.md - Detailed test output (auto-generated)
- FINDINGS.md - In-depth analysis and issue summary
- ../ACCURACY_REPORT.md - Complete accuracy report
- Arrow function support
- Function expression support
- Class method detection
- Investigate missing function declarations
- Improve logical operator complexity calculation
- Enhance nested function detection reliability
- Immediate Investigation: Why are
complexConditionsandcreateValidatorin test-05 not detected? - Incremental Fix: Start with arrow functions (biggest impact)
- Continuous Testing: Re-run this test suite after each fix
- Extend Tests: Add more test cases based on newly discovered issues
# Test a single file
../target/release/codescope 01-arrow-functions.tsx
# JSON output for details
../target/release/codescope 02-function-declarations.ts -f json | jq
# View detected functions
../target/release/codescope 02-function-declarations.ts -f json | \
jq '.symbols[] | select(.kind == "function") | {name, loc, complexity}'If you discover new edge cases or issues:
- Create a new test file in
test-suite/ - File naming format:
XX-description.ts(x) - Add comments explaining expected detection results
- Update
run-tests.shto add the new test - Update this README