Guard against drift between `plasterManifest.xml` and the `Invoke-Plaster` test stub

Open Beginner friendly
#562 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
powershell
Domain
testing-qa

Research direction

Start by reading the stub in tests/Unit/Public/New-SampleModule.tests.ps1 and the parameter entries in Sampler/Templates/Sampler/plasterManifest.xml. Add the guard under tests/Unit/Public/, then run ./build.ps1 -Tasks test -PesterPath 'tests/Unit/Public/New-SampleModule.tests.ps1' -CodeCoverageThreshold 0; done means the test detects a missing stub parameter.

Written by the indexing model from the issue text.

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 <parameter name="UseSomething" ...> 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 <parameter name="..."> 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.

Dominant language
PowerShell
Stars
243
Forks
46
Avg merge
1h 41m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from gaelcolas/Sampler

All issues in gaelcolas/Sampler

Similar issues

More Testing & QA issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.