testing: improve test coverage representation from the runtests tools#301254
Merged
connor4312 merged 4 commits intomainfrom Mar 13, 2026
Merged
testing: improve test coverage representation from the runtests tools#301254connor4312 merged 4 commits intomainfrom
connor4312 merged 4 commits intomainfrom
Conversation
…ive tests - Extracts 6 pure helper functions (buildTestRunSummary, getCoverageSummary, getOverallCoverageSummary, getFileCoverageDetails, mergeLineRanges, getFailureDetails) as module-level exports for better testability - Makes RunTestTool class public to allow external instantiation in tests - Adds comprehensive 44-test suite covering all helper functions and tool behavior - Tests include coverage details formatting, failure message handling, test result summarization, and line range merging logic - Uses upcastPartial<T>() for type-safe mock creation without any type casts (Commit message generated by Copilot)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the Testing chat agent’s RunTestTool implementation to make its result/coverage formatting logic independently testable, and adds a dedicated unit test suite to validate the extracted helpers and key tool behaviors.
Changes:
- Exports
RunTestTooland extracts several summary/coverage/failure formatting helpers as module-level exports. - Updates coverage reporting behavior to support an overall summary when
coverageFilesisn’t provided. - Adds a comprehensive unit test suite covering the new helpers and tool invocation/preparation behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/vs/workbench/contrib/testing/common/testingChatAgentTool.ts |
Exports RunTestTool and introduces exported helper functions for summary/coverage/failure formatting. |
src/vs/workbench/contrib/testing/test/common/testingChatAgentTool.test.ts |
New unit tests for the extracted helpers and RunTestTool behaviors. |
You can also share your feedback on Copilot code review. Take the survey.
src/vs/workbench/contrib/testing/common/testingChatAgentTool.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/testing/test/common/testingChatAgentTool.test.ts
Outdated
Show resolved
Hide resolved
- Fix getCoverageSummary() returning early from a task that had coverage but no matching coverageFiles, preventing subsequent tasks from being checked - Use URI.file().fsPath instead of hardcoded POSIX path strings in test assertions for cross-platform compatibility (Commit message generated by Copilot)
Yoyokrazy
approved these changes
Mar 13, 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.
getOverallCoverageSummary, getFileCoverageDetails, mergeLineRanges,
getFailureDetails) as module-level exports for better testability
summarization, and line range merging logic