Skip to content

fix(javascript): discover TypeScript tests without expanding source scope - #783

Open
daBOB wants to merge 1 commit into
peteromallet:mainfrom
daBOB:fix/javascript-typescript-test-discovery
Open

daBOB wants to merge 1 commit into
peteromallet:mainfrom
daBOB:fix/javascript-typescript-test-discovery

Conversation

@daBOB

@daBOB daBOB commented Sep 24, 2026

Copy link
Copy Markdown

Problem

A JavaScript scan discovers production .js/.jsx/.mjs/.cjs files but silently misses tests written in TypeScript. The JavaScript plugin leaves test_file_extensions at the production-extension default, so normal test/*.test.ts suites do not contribute to test mapping.

An additional boundary affects scans from the project root: the supplemental discovery helper skips test directories beneath the scanned path, assuming the source finder already saw their files. That assumption fails when test extensions differ from production extensions.

Change

  • Configure JavaScript test discovery to accept .ts, .tsx, .mts and .cts alongside the existing JavaScript extensions. Production extensions remain unchanged.
  • In standard/configured test directories beneath the scan root, collect only test extensions omitted by production discovery. Already-scanned JavaScript tests retain their existing path and are not added again.
  • Keep import resolution and test inference unchanged; the existing hooks resolve these tests against the JavaScript production set.

Validation

  • 32 real production-phase cases cover eight test extensions with relative/absolute subdirectory and project-root scans. They verify successful import mapping, JavaScript-only production scope, excluded TypeScript context, and an unrelated JavaScript file that remains untested.
  • The initial external-TypeScript cases failed before plugin configuration (8 failed / 8 JavaScript controls passed). The project-root TypeScript cases then failed before the shared-helper correction (8 failed / 24 passed).
  • Focused discovery tests: 37 passed. JavaScript/shared framework suite: 538 passed, 2 skipped. Ruff and whitespace checks pass.
  • Read-only verification against a real browser workspace, with fix: preserve dependency edges for relative tree-sitter file paths #781's path normalization held constant: the same 55 JavaScript production files and 132 graph edges; external candidates increase from 0 to 117 TypeScript files (111 named tests plus 6 support files); test-gap findings change from 50 to 17. Source and scanner-state hashes are unchanged. Remaining findings require normal adjudication; these counts demonstrate discovery, not whether every behavior is tested.

The validation checkout combines this patch with #777, #778, #781 and #782; those other changes are not included in this PR. Full combined suite: 6932 passed, 23 skipped, 2 failed. Both failures are the duplicated historical test_do_run_batches_dry_run_generates_packet_and_prompts cases, independently reproduced on pristine base 3a7735d.

Existing limitations remain: discovery uses the configured test directories, and dynamically constructed imports, query-suffixed imports and CommonJS patterns retain their current mapping behavior. No application code, scanner dispositions or installed CLI was changed to produce the verification.

github-actions Bot added a commit to citizenadam/desloppify that referenced this pull request Sep 24, 2026

This branch has not been deployed

No deployments
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.

1 participant