Test coverage: exclude counterfact-types from Jest and add tests for untested files#1877
Merged
pmcelhaney merged 2 commits intomainfrom Apr 15, 2026
Merged
Conversation
Closed
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsis 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 testcompletes with all suites passing and no failuressrc/counterfact-types/orsrc/server/config.tsentrieswindows-escape.tsshows 100% coverage (was 85%)paths-to-routes.tsshows 100% coverage (was 0%)telemetry.tsshows ~93% coverage (was 0%); remaining uncovered lines are PostHog network error catch blocksread-file.tsshows ~86% coverage (was 0%); remaining uncovered line is the live HTTP fetch branchTasks
jest.config.js— added!src/counterfact-types/**and!src/server/config.tstocollectCoverageFromtest/util/windows-escape.test.ts— covers bothescapePathForWindows(including the Windows drive-letter branch that was missing) andunescapePathForWindowstest/util/read-file.test.ts— covers file-path andfile://URL branches viausingTemporaryFilestest/cli/telemetry.test.ts— covers allisTelemetryEnabledbranches (CI env, explicit opt-in/out, pre-rollout default) and smoke-testssendTelemetrytest/migrate/paths-to-routes.test.ts— covers recursive file copy, content rewrite (path-types→types/paths), and missing-source-dir resilience