Fix explicit empty text defaults - #474
Conversation
Test Results 4 files 292 suites 1m 10s ⏱️ Results for commit 22a008f. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
🟡 Changes recommended
Two moderate conversion issues remain, and the issue reference does not match the implemented scope.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR preserves explicitly empty text defaults during manifest conversion and allows blank input when such defaults are declared.
Changes:
- Preserve empty JSON defaults.
- Allow configured blank text responses.
- Add regression and end-to-end coverage.
File summaries
| File | Review summary |
|---|---|
tests/EmptyDefaultTextParameter.Tests.ps1 |
Adds regression coverage; the Fixes #43 reference appears unrelated to the implemented scope. |
Plaster/Private/Resolve-ProcessParameter.ps1 |
Enables empty input for declared defaults; the linked issue’s requested localized-variable support is not implemented. |
Plaster/Private/Read-PromptForInput.ps1 |
Implements optional blank input handling. |
Plaster/Private/ConvertFrom-JsonManifest.ps1 |
Preserves empty defaults, but conditional processing and reverse conversion still require fixes to retain explicit empty defaults. |
Review details
Suppressed comments (3)
Plaster/Private/ConvertFrom-JsonManifest.ps1:74
- When a JSON text parameter has
conditionevaluate false anddefaultis"", this conversion now emits the attribute, butResolve-ProcessParameterstill checks-not [string]::IsNullOrEmpty($default)and stores$nullinstead of the explicit empty string. That loses the newly supported default before content processing; use attribute presence in that branch and add a conditional regression test.
if ($param.PSObject.Properties.Match('default').Count -gt 0) {
Plaster/Private/ConvertFrom-JsonManifest.ps1:74
- Please also update the reverse conversion.
ConvertTo-JsonManifeststill usesif ($paramNode.default)and therefore drops an XMLdefault=""; an XML→JSON→XML round trip loses the explicit marker this change relies on, so the converted template stops accepting blank input. Add aHasAttribute('default')check there and a round-trip regression.
if ($param.PSObject.Properties.Match('default').Count -gt 0) {
Plaster/Private/Resolve-ProcessParameter.ps1:79
- The linked issue #43 requests support for using localized-data hashtables (for example,
$PLASTER_MyTemplate.ManifestComment) inside generated templates, but this change only preserves and accepts empty text defaults. As written, closing #43 from this PR does not satisfy that requirement; please correct the issue link/description or add the localized-variable implementation.
$value = Read-PromptForInput $prompt $default $pattern -AllowEmpty:$Node.HasAttribute('default')
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Preserve declared empty JSON defaults and distinguish them from missing defaults so blank text input is accepted only when explicitly configured.
38a6113 to
22a008f
Compare
## [2.1.4] - 2026-09-13 ### Fixed - Explicit empty text defaults in JSON manifests now remain empty rather than being treated as absent, while blank prompt input is accepted only when a default is declared ([#474](#474), closes [#473](#473)) - Pester 6.1.0 compatibility for mocks and empty `-ForEach` data sets ([#475](#475))
Summary
default: ""Verification
pwsh -NoLogo -NoProfile -Command '$cfg = New-PesterConfiguration; $cfg.Run.Path = "./tests/EmptyDefaultTextParameter.Tests.ps1"; $cfg.Output.Verbosity = "Normal"; $cfg.Run.PassThru = $true; $result = Invoke-Pester -Configuration $cfg; exit $result.FailedCount'Fixes #473.