Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host Program does not support User Interaction #139

Open
DominikJaniec opened this issue Mar 4, 2023 · 1 comment
Open

Host Program does not support User Interaction #139

DominikJaniec opened this issue Mar 4, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@DominikJaniec
Copy link

DominikJaniec commented Mar 4, 2023

Have a simple test file like:

Describe 'the host program' {
    It 'supports user interaction' {
        $Host.UI.RawUI.WindowTitle = "magic"
        $title = $Host.UI.RawUI.WindowTitle
        $title | Should -Not -BeNullOrEmpty
    }
}

It will successfully pass when executed with "Debug Test". However, when stared via "Run Test", it will fail on its first line (e.g. $Host.UI.RawUI.WindowTitle = "magic") with a message as:

Exception setting "WindowTitle": "A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the PowerShell Console, and remove prompt-related commands from command types that do not support user interaction."

It would be also useful to have some defaults within properties of $Host.UI.RawUI.

@JustinGrote
Copy link
Collaborator

The test runs operate within their own dedicated process, so UI pester tests are unsupported there, however if you run the tests via debug then they run in the PS Extension which should be supported.

I do have a potential refactor coming to move everything into the PS Extension as a separate runspace which may make this functional

@JustinGrote JustinGrote added the enhancement New feature or request label Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants