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

Console.WriteLine hangs test execution

Open slaugaus opened this issue 10 months ago • 1 comments

Test execution gets stuck if the test uses [Console]::WriteLine to print something, unless it's JSON.

Demo:

Describe 'Pester Tests Extension' {
    It 'Is Fine With JSON' {
        [Console]::WriteLine('{"valid": "json"}')
    }

    It 'Is Fine With Write-Host' {
        Write-Host 'not json'
    }

    It 'Dislikes Console.WriteLine' {
        [Console]::WriteLine('not json')
    }
}

Executing it directly works: Image

If I execute it through the extension, execution gets stuck on the third test: Image

When I click Cancel Test Run (stop icon), I get this error: Image

slaugaus avatar Apr 22 '25 01:04 slaugaus

This is probably because I use writeline in the testadapter for IPC communication. I've been meaning to rewrite this to use a different model based on my PowerServe project that will resolve that. For now this probably won't get fixed anytime soon till I get to that but thanks for using the extension!

JustinGrote avatar Apr 22 '25 02:04 JustinGrote