Skip to content

Test coverage: exclude counterfact-types from Jest and add tests for untested files#1877

Merged
pmcelhaney merged 2 commits intomainfrom
copilot/exclude-counterfact-types-directory
Apr 15, 2026
Merged

Test coverage: exclude counterfact-types from Jest and add tests for untested files#1877
pmcelhaney merged 2 commits intomainfrom
copilot/exclude-counterfact-types-directory

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

Summary

src/counterfact-types/ is pure TypeScript type declarations — no runtime code, so V8 coverage reported it as 0% and polluted the report. Similarly, src/server/config.ts is a single interface definition. Both are now excluded from coverage collection. Four previously untested modules now have unit tests.

Original Prompt

Exclude the Counterfact-types directory from Jest as it's purely types.

Add tests for any other files that are completely untested.

Manual acceptance tests

  • yarn test completes with all suites passing and no failures
  • Coverage report no longer lists src/counterfact-types/ or src/server/config.ts entries
  • windows-escape.ts shows 100% coverage (was 85%)
  • paths-to-routes.ts shows 100% coverage (was 0%)
  • telemetry.ts shows ~93% coverage (was 0%); remaining uncovered lines are PostHog network error catch blocks
  • read-file.ts shows ~86% coverage (was 0%); remaining uncovered line is the live HTTP fetch branch

Tasks

  • jest.config.js — added !src/counterfact-types/** and !src/server/config.ts to collectCoverageFrom
  • test/util/windows-escape.test.ts — covers both escapePathForWindows (including the Windows drive-letter branch that was missing) and unescapePathForWindows
  • test/util/read-file.test.ts — covers file-path and file:// URL branches via usingTemporaryFiles
  • test/cli/telemetry.test.ts — covers all isTelemetryEnabled branches (CI env, explicit opt-in/out, pre-rollout default) and smoke-tests sendTelemetry
  • test/migrate/paths-to-routes.test.ts — covers recursive file copy, content rewrite (path-typestypes/paths), and missing-source-dir resilience

src/cli/run.ts remains at 0% unit-test coverage; it's the CLI bootstrap that wires together the entire server startup and is covered by the black-box integration tests in test-black-box/.

Copilot AI linked an issue Apr 15, 2026 that may be closed by this pull request
@pmcelhaney pmcelhaney marked this pull request as ready for review April 15, 2026 18:21
@pmcelhaney pmcelhaney enabled auto-merge April 15, 2026 18:21
Copilot AI changed the title [WIP] Exclude Counterfact-types directory from Jest and add tests Test coverage: exclude counterfact-types from Jest and add tests for untested files Apr 15, 2026
Copilot AI requested a review from pmcelhaney April 15, 2026 18:22
@pmcelhaney pmcelhaney added this pull request to the merge queue Apr 15, 2026
Merged via the queue into main with commit 008df09 Apr 15, 2026
8 of 10 checks passed
@pmcelhaney pmcelhaney deleted the copilot/exclude-counterfact-types-directory branch April 15, 2026 18:30
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.

Test coverage

2 participants