-
Notifications
You must be signed in to change notification settings - Fork 197
Surface empty BCPT results as a warning instead of silent success #2229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -78,6 +78,35 @@ Describe "AnalyzeTests Action Tests" { | |||||
| $bcpt."SUITE1"."1".operations."operation2".measurements.Count | should -Be 4 | ||||||
| } | ||||||
|
|
||||||
| It 'Test ReadBcptFile returns null when file does not exist' { | ||||||
| . (Join-Path $scriptRoot '../AL-Go-Helper.ps1') | ||||||
| . (Join-Path $scriptRoot 'TestResultAnalyzer.ps1') | ||||||
| $bcpt = ReadBcptFile -bcptTestResultsFile 'non-existent-file.json' | ||||||
| $bcpt | Should -BeNullOrEmpty | ||||||
|
||||||
| $bcpt | Should -BeNullOrEmpty | |
| $bcpt | Should -Be $null |
Copilot
AI
Apr 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “file exists but contains no entries” test writes JSON null to disk. BCPT result files appear to be JSON arrays (your helper uses @(...) | ConvertTo-Json), so an empty-results file would more realistically be [] (empty array). Using an empty array here would better match the real-world format and protect against differences in how ConvertFrom-Json handles null vs [].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new warning annotation block is effectively unreachable:
GetBcptSummaryMDonly returns an empty/falsey value when the results file does not exist, but this condition requires the file to exist (Test-Path ... -PathType Leaf). If the intention is to surface an empty-results warning annotation, consider keying this check off the parsed BCPT contents (e.g.,ReadBcptFilereturning an empty hashtable) or emitting the warning fromGetBcptSummaryMDwhen it detects an empty results file.