Context and request
tests/Json.Tests.ps1 does not follow the PowerShell Function Test Specification. The suite opens with Describe 'Module' and groups by concern — Context 'Format-Json', Context 'Data Type Handling', Context 'Complex JSON Structures' — so tests for a single command are scattered across contexts and there is no per-command Describe. It names such as Should compact pretty JSON do not name the command under test, which makes a failure in the CI summary ambiguous about which command broke.
The suite also writes to the host inside It blocks via LogGroup/Write-Host wrappers around nearly every assertion, which adds noise without adding diagnostic value that Pester's own failure output does not already provide.
The framework's FunctionTest check only verifies that each public command is referenced somewhere under tests/, so the current layout passes structurally. This is about making the suite navigable, not about satisfying a gate.
Acceptance criteria.
- The suite follows
Describe '<Module>' → Describe '<Function>' → Context '<Function> - <use case>' → It '<Function> - <expected behavior>'.
- Every
It name states the command and the behaviour it asserts, so a CI failure line identifies both without opening the file.
- Every existing assertion is preserved; no test is dropped in the restructure.
- Code coverage remains at or above the 95% target in
.github/PSModule.yml.
- The suite passes on Linux, macOS, and Windows.
Technical decisions
The module keeps the Simple profile from the Tests section — a single root tests/Json.Tests.ps1. With three commands there is no reason to split into per-group files, and doing so would change the TestName values the workflow derives from file basenames.
This is a mechanical restructure with no assertion changes, so it ships separately from the pipeline fix. Reviewing a large move diff alongside a version bump would hide regressions in both.
LogGroup/Write-Host calls are removed from It blocks. They belong in BeforeAll when a fixture genuinely needs explaining; Pester reports actual versus expected on failure already.
The PSAvoidUsingWriteHost and PSAvoidLongLines suppression attributes at the top of the file should be re-evaluated once the Write-Host calls are gone — a suppression that no longer suppresses anything is misleading.
Depends on the Pester 6 requirement landing first, so the restructured suite is written against the version it will actually run under.
Implementation plan
Context and request
tests/Json.Tests.ps1does not follow the PowerShell Function Test Specification. The suite opens withDescribe 'Module'and groups by concern —Context 'Format-Json',Context 'Data Type Handling',Context 'Complex JSON Structures'— so tests for a single command are scattered across contexts and there is no per-commandDescribe.Itnames such asShould compact pretty JSONdo not name the command under test, which makes a failure in the CI summary ambiguous about which command broke.The suite also writes to the host inside
Itblocks viaLogGroup/Write-Hostwrappers around nearly every assertion, which adds noise without adding diagnostic value that Pester's own failure output does not already provide.The framework's
FunctionTestcheck only verifies that each public command is referenced somewhere undertests/, so the current layout passes structurally. This is about making the suite navigable, not about satisfying a gate.Acceptance criteria.
Describe '<Module>'→Describe '<Function>'→Context '<Function> - <use case>'→It '<Function> - <expected behavior>'.Itname states the command and the behaviour it asserts, so a CI failure line identifies both without opening the file..github/PSModule.yml.Technical decisions
The module keeps the Simple profile from the Tests section — a single root
tests/Json.Tests.ps1. With three commands there is no reason to split into per-group files, and doing so would change theTestNamevalues the workflow derives from file basenames.This is a mechanical restructure with no assertion changes, so it ships separately from the pipeline fix. Reviewing a large move diff alongside a version bump would hide regressions in both.
LogGroup/Write-Hostcalls are removed fromItblocks. They belong inBeforeAllwhen a fixture genuinely needs explaining; Pester reports actual versus expected on failure already.The
PSAvoidUsingWriteHostandPSAvoidLongLinessuppression attributes at the top of the file should be re-evaluated once theWrite-Hostcalls are gone — a suppression that no longer suppresses anything is misleading.Depends on the Pester 6 requirement landing first, so the restructured suite is written against the version it will actually run under.
Implementation plan
Describe 'Json'with a nestedDescribeper public commandData Type HandlingandComplex JSON Structuresassertions intoContextblocks under the command they exerciseItto<Function> - <expected behavior>LogGroup/Write-HostfromItblocks, keeping fixture setup inBeforeAll