Guard against drift between `plasterManifest.xml` and the `Invoke-Plaster` test stub
- Dominant language
- PowerShell
- Stars
- 243
- Forks
- 46
- Avg merge
- 1h 41m
- Merged PRs (30d)
- 1
Description
**Problem description**
PR #560 added unit tests in `tests/Unit/Public/New-SampleModule.tests.ps1` that replace `Invoke-Plaster` with a hand-maintained stub listing every Plaster parameter statically. The stub is required because `Invoke-Plaster` declares manifest-driven parameters via `dynamicparam`, which Pester's auto-generated mock proxy cannot model.
When a new `Use*` toggle or parameter is added to `Sampler/Templates/Sampler/plasterManifest.xml`, the stub will silently drop it — `$PSBoundParameters` will not contain it and the tests will keep passing while real scaffolding behavior regresses.
**Verbose logs**
N/A
**How to reproduce**
1. Add a new `` entry to `Sampler/Templates/Sampler/plasterManifest.xml`.
2. Do not update the stub in `tests/Unit/Public/New-SampleModule.tests.ps1`.
3. Run `./build.ps1 -Tasks test -PesterPath 'tests/Unit/Public/New-SampleModule.tests.ps1' -CodeCoverageThreshold 0`.
4. Observe that tests pass even though the stub does not accept the new parameter.
**Expected behavior**
A test fails when the stub's `param()` block is out of sync with the parameters defined in `plasterManifest.xml`.
**Current behavior**
No such check exists; drift is silent.
**Suggested solution**
Add a lightweight guard test under `tests/Unit/Public/` that:
1. Parses `Sampler/Templates/Sampler/plasterManifest.xml`.
2. Enumerates `` nodes.
3. Asserts every name is present in `(Get-Command Invoke-Plaster).Parameters.Keys` within `InModuleScope`.
Consider also documenting the stub pattern in `.github/instructions/test-writing.instructions.md`.
**Operating system the target node is running**
N/A
**PowerShell version and build the target node is running**
N/A
**Module version used**
Sampler `Unreleased` / post-#560.
Contributor guide
Assessment
This issue has not been assessed yet.