Customizing unit tests in the VS Code extension#66
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const fallbackStatus = | ||
| classResult.status === TestStatus.Failed && !hasSpecificFailures && !classResult.assertions?.length | ||
| ? TestStatus.Failed | ||
| : classResult.status ?? TestStatus.Passed; | ||
|
|
There was a problem hiding this comment.
Prevent class-level failures from marking every method failed
In deriveMethodResultsFromClassSummary, fallbackStatus is set to the class’s overall status even when hasSpecificFailures is true, and this fallback is then applied to every method that lacks an explicit summary later in the function. When the legacy runner returns a class-level result marked Failed plus failure/assertion details for only a few methods (common when method is omitted), all other methods are still marked Failed despite no evidence they failed, producing false failures in the Test Explorer/decorations. The fallback should not default to Failed once specific failing methods have already been identified.
Useful? React with 👍 / 👎.
Summary of Customizations
Changes
Added inline status decoration
Each test method now shows a clean inline decoration (status + duration) without modifying the file contents.
Improved test output mapping
Test output is now properly grouped per method and attached to the correct TestItem, ensuring that selecting a method in Test Results shows its console output and summary line.
Removed inline output artifacts
Eliminated the issue where summary/output lines were being rendered inside the editor along with decorations.
Added summary message for classes with failures
When a class-level result contains failures, a readable summary message is generated listing which methods failed.
Workspace root grouping
Fixed the issue where multiple test roots matched by wildcard patterns (*) produced duplicate namespace items (e.g., many DESENV75 entries).
Now all roots belonging to the same workspace/namespace are grouped under a single root node, while still respecting all configured relativeTestRoots.