Skip to content

test: add coverage for ternary, catch, nullish coalescing, labeled jumps, and cache#247

Merged
askpt merged 1 commit intomainfrom
repo-assist/test-coverage-improvements-2026-04-07-a36dc20f4abcb512
Apr 9, 2026
Merged

test: add coverage for ternary, catch, nullish coalescing, labeled jumps, and cache#247
askpt merged 1 commit intomainfrom
repo-assist/test-coverage-improvements-2026-04-07-a36dc20f4abcb512

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 7, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Adds 12 new unit tests across four new describe blocks to cover code paths that were previously untested. metricsAnalyzerFactory.ts now achieves 100 % statement, branch, function, and line coverage under npm run test:unit.

What was uncovered

Analyzer / Module Previously uncovered paths
typescriptAnalyzer.ts ternary expressions, catch clauses, ?? operator, labeled break/continue
javascriptAnalyzer.ts same patterns
metricsAnalyzerFactory.ts cache hits, cache eviction (LRU path), createAnalyzer error throw

New test suites added (in src/unit/unit.test.ts)

  • TypeScript Analyzer Additional Coverage: ternary, try/catch, nullish coalescing ??, labeled break
  • JavaScript Analyzer Additional Coverage: ternary, try/catch, nullish coalescing ??, labeled continue
  • Analysis Cache Behavior: cache-hit consistency, LRU eviction with 21 distinct entries, unsupported language bypasses cache
  • createAnalyzer Error Handling: verifies the informative error thrown when a module lacks the expected class

Coverage delta

File Stmts before → after Branches before → after
metricsAnalyzerFactory.ts 96.28 → 100 76.92 → 100
typescriptAnalyzer.ts 86.16 → 88.66 71.05 → 80.76
javascriptAnalyzer.ts 90.00 → 92.22 77.90 → 84.09

Test Status

  • npm run compile ✅ no errors
  • npm run lint ✅ no errors
  • npm run test:unit47 tests pass (was 35)

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@7c7feb61a52b662eb2089aa2945588b7a200d404

…mps, and cache

Previously uncovered paths in the TypeScript and JavaScript analyzers
(ternary expressions, catch clauses, nullish-coalescing ??, labeled
break/continue) now have dedicated unit tests.  Two new suites cover:

- Analysis cache behaviour: hit consistency and LRU eviction under load
- createAnalyzer error handling: throws correctly for a missing class

metricsAnalyzerFactory.ts now achieves 100 % statement/branch coverage.
Overall branch coverage for the analyzer languages improves from ~75 % to
~82 %.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@askpt askpt changed the title [Repo Assist] test: add coverage for ternary, catch, nullish coalescing, labeled jumps, and cache test: add coverage for ternary, catch, nullish coalescing, labeled jumps, and cache Apr 9, 2026
@askpt askpt marked this pull request as ready for review April 9, 2026 08:15
@askpt askpt self-requested a review as a code owner April 9, 2026 08:15
Copilot AI review requested due to automatic review settings April 9, 2026 08:15
@askpt askpt closed this Apr 9, 2026
@askpt askpt reopened this Apr 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.80%. Comparing base (5f1c749) to head (ecbd02a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #247      +/-   ##
==========================================
+ Coverage   67.26%   68.80%   +1.53%     
==========================================
  Files           8        8              
  Lines        2936     2936              
  Branches      276      283       +7     
==========================================
+ Hits         1975     2020      +45     
+ Misses        959      914      -45     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the Node.js unit test suite to cover previously untested cognitive-complexity paths in the JavaScript/TypeScript analyzers and MetricsAnalyzerFactory (cache behavior and createAnalyzer error handling), aiming to improve coverage under npm run test:unit.

Changes:

  • Added new TypeScript analyzer tests for ternary, catch clauses, nullish coalescing, and labeled break.
  • Added new JavaScript analyzer tests for the same patterns (with labeled continue).
  • Added new tests targeting MetricsAnalyzerFactory cache behavior and createAnalyzer’s thrown error message.

@askpt askpt merged commit 27d31cc into main Apr 9, 2026
27 checks passed
@askpt askpt deleted the repo-assist/test-coverage-improvements-2026-04-07-a36dc20f4abcb512 branch April 9, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants