Skip to content

Test that Expected is mandatory via metadata, not by invoking without it - #2965

Open
nohwnd wants to merge 1 commit into
pester:mainfrom
nohwnd:fix-mandatory-test-prompt-hang
Open

Test that Expected is mandatory via metadata, not by invoking without it#2965
nohwnd wants to merge 1 commit into
pester:mainfrom
nohwnd:fix-mandatory-test-prompt-hang

Conversation

@nohwnd

@nohwnd nohwnd commented Aug 6, 2026

Copy link
Copy Markdown
Member

Follow-up to #2963. The "Requires Expected" tests on Should-NotBeString, Should-BeFasterThan and Should-BeSlowerThan (#2938) invoked the assertion with the mandatory Expected missing and expected a ParameterBindingException. That only throws in a non-interactive host. Interactively (a local test.ps1 run, or the release build before #2963) a missing mandatory parameter prompts for the value and hangs forever.

Check the parameter metadata reports Mandatory instead, so the test never prompts regardless of host. #2963 keeps the release non-interactive as defense in depth.

🤖

The "Requires Expected" tests invoked the assertion with the mandatory
Expected missing and expected a ParameterBindingException. A missing
mandatory parameter makes PowerShell prompt for the value, which throws only
in a non-interactive host. In an interactive test.ps1 run, or the release
build (before pester#2963), it prompts and hangs forever instead.

Check the parameter metadata says Mandatory instead, so the test never
prompts regardless of host.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant