vscode-adapter icon indicating copy to clipboard operation
vscode-adapter copied to clipboard

Host Program does not support User Interaction

Open DominikJaniec opened this issue 1 year ago • 1 comments

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.

DominikJaniec avatar Mar 04 '23 22:03 DominikJaniec

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 avatar Jul 26 '23 23:07 JustinGrote