Skip to content

testing: improve test coverage representation from the runtests tools#301254

Merged
connor4312 merged 4 commits intomainfrom
connor4312/testing-tool-refactoring
Mar 13, 2026
Merged

testing: improve test coverage representation from the runtests tools#301254
connor4312 merged 4 commits intomainfrom
connor4312/testing-tool-refactoring

Conversation

@connor4312
Copy link
Member

  • 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() for type-safe mock creation without any type casts

…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)
Copilot AI review requested due to automatic review settings March 12, 2026 21:31
@connor4312 connor4312 enabled auto-merge March 12, 2026 21:31
@connor4312 connor4312 changed the title testing: extract helper functions from RunTestTool and add comprehensive tests testing: improve test coverage representation from the runtests tools Mar 12, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 RunTestTool and extracts several summary/coverage/failure formatting helpers as module-level exports.
  • Updates coverage reporting behavior to support an overall summary when coverageFiles isn’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.

- 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)
@connor4312 connor4312 merged commit 98822b9 into main Mar 13, 2026
20 checks passed
@connor4312 connor4312 deleted the connor4312/testing-tool-refactoring branch March 13, 2026 00:07
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.

3 participants