Skip to content

Handle empty test failure stack traces#2259

Closed
kiwigitops wants to merge 1 commit into
microsoft:mainfrom
kiwigitops:fix-empty-failure-stacktrace
Closed

Handle empty test failure stack traces#2259
kiwigitops wants to merge 1 commit into
microsoft:mainfrom
kiwigitops:fix-empty-failure-stacktrace

Conversation

@kiwigitops
Copy link
Copy Markdown

Summary

  • use InnerText when reading failure stack traces so empty XML failure nodes produce an empty string instead of $null
  • keep the existing stack trace formatting for non-empty failures
  • add a regression test with an empty <failure> node

Closes #2256.

Testing

  • git diff --check
  • Invoke-Pester -Path .\Tests\AnalyzeTests.Test.ps1 could not run locally because the installed Windows PowerShell Pester module is 3.4.0 and does not provide the repo helper's Add-AssertionOperator command.

Copilot AI review requested due to automatic review settings May 20, 2026 19:04
@kiwigitops kiwigitops requested a review from a team as a code owner May 20, 2026 19:04
Copy link
Copy Markdown
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

Fixes the AnalyzeTests “normal” test result summarization to tolerate <failure> elements with no stack trace content (empty XML nodes), preventing runtime errors during markdown/HTML failure summary generation.

Changes:

  • Switch stack trace extraction from ."#text" to .InnerText and reuse a normalized $stackTrace value for both log output and failure summary nodes.
  • Add a Pester regression test that writes a minimal TestResults.xml containing an empty <failure> node and asserts GetTestResultSummaryMD does not throw.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Actions/AnalyzeTests/TestResultAnalyzer.ps1 Uses .InnerText to reliably read empty failure nodes as "" (not $null) and preserves existing formatting behavior for non-empty traces.
Tests/AnalyzeTests.Test.ps1 Adds regression coverage for empty <failure> stack traces by asserting GetTestResultSummaryMD runs without exceptions.

@aholstrup1
Copy link
Copy Markdown
Collaborator

Issue already being handled in #2257

@aholstrup1 aholstrup1 closed this May 21, 2026
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.

[Bug]: Test Result Analyzer fails if no stack trace is available

3 participants