Add default values for unused script parameters to container's Data before executing BeforeDiscovery. Avoids changes to the variables in BeforeDiscover from being captured and sent to Run-phase.
Known limitation: Changing the variable outside BeforeDiscovery/Describe/Context would still modify it in Data. Can't fix as we don't have a hook to execute code before it. Root-level code is also discouraged in Pester v5.
Fix #2359
PR Checklist
[x] PR has meaningful title
[x] Summary describes changes
[x] PR is ready to be merged
If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
PR Summary
Add default values for unused script parameters to container's Data before executing
BeforeDiscovery
. Avoids changes to the variables inBeforeDiscover
from being captured and sent to Run-phase.Known limitation: Changing the variable outside
BeforeDiscovery/Describe/Context
would still modify it in Data. Can't fix as we don't have a hook to execute code before it. Root-level code is also discouraged in Pester v5.Fix #2359
PR Checklist
Create Pull Request
to mark it as a draft. PR can be markedReady for review
when it's ready.