Skip to content

feat: add JavaScript test_coverage hooks for test mapping#515

Open
elfensky wants to merge 2 commits intopeteromallet:mainfrom
elfensky:fix/javascript-test-coverage-hooks
Open

feat: add JavaScript test_coverage hooks for test mapping#515
elfensky wants to merge 2 commits intopeteromallet:mainfrom
elfensky:fix/javascript-test-coverage-hooks

Conversation

@elfensky
Copy link
Copy Markdown

Summary

Closes #514

The JavaScript language plugin was missing a test_coverage.py module, causing the test coverage detector to silently return empty results for pure JS projects (e.g., Next.js without TypeScript).

  • Created desloppify/languages/javascript/test_coverage.py — adapted from the TypeScript version with JS-appropriate extensions (.js, .jsx, .mjs, .cjs) and nested __tests__/unit/ directory handling
  • Updated desloppify/languages/javascript/__init__.py — registered the test_coverage_module via generic_lang()
  • Updated desloppify/engine/detectors/coverage/mapping_imports.py — added .mjs and .cjs to _infer_lang_name() extension map

Test results

  • All 5657 existing tests pass, 0 regressions
  • Standardization test (test_lang_standardization.py) passes — JS plugin meets the contract
  • Verified on elfensky/helldivers.bot (Next.js, no TypeScript, .mjs files, jsconfig.json):
    • Before: Test health 2.7%, 87 test coverage issues, only 1/16 test files recognized
    • After: Test health 15.1%, 74 test coverage issues, all 16 test files correctly mapped

🤖 Generated with Claude Code

elfensky and others added 2 commits March 27, 2026 20:59
The JavaScript language plugin was missing a test_coverage module,
causing the test coverage detector to silently return empty results
for pure JS projects (e.g. Next.js without TypeScript). This adds
the missing hooks and fixes .mjs/.cjs extension mapping.

Closes peteromallet#514

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 tests covering map_test_to_source (including __tests__/unit/ traversal),
has_testable_logic, strip_test_markers, parse_test_import_specs, and
contract exports. Also adds /index.jsx and /index.cjs to _JS_EXTENSIONS.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JavaScript plugin missing test_coverage hooks — test mapping always empty

1 participant