Skip to content

Console.WriteLine hangs test execution #287

@slaugaus

Description

@slaugaus

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions