I have added a new unit test file for Pester 5 to my Powershell repo in VS code.
When I try to run/debug it, I get a prompt in Terminal:
cmdlet BeforeAll at command pipeline position 1
Supply values for the following parameters:
Scriptblock:
If I enter a random string "hgj", I get the error:
[-] Discovery in C:\XXX.Tests.ps1 failed with:
System.Management.Automation.ParameterBindingArgumentTransformationException: Cannot process argument transformation on parameter 'Scriptblock'. Cannot convert the "hgj" value of type "System.String" to type "System.Management.Automation.ScriptBlock". ---> System.Management.Automation.ArgumentTransformationMetadataException: Cannot convert the "hgj" value of type "System.String" to type "System.Management.Automation.ScriptBlock". ---> System.Management.Automation.PSInvalidCastException: Cannot convert the "hgj" value of type "System.String" to type "System.Management.Automation.ScriptBlock".
This is the unit test file:
BeforeAll
{
}
Describe 'Start-Package564'
{
It 'Runs Start-Package'
{
}
}
If I comment out Before-All, everything works.
If I add some code in Before-All, I still get the prompt and the error.
Why does Before-All cause the Terminal to prompt for a scriptblock?