Skip to content

Failed test names when BeforeAll fails aren't shown #2646

@davidmatson

Description

@davidmatson

Checklist

What is the issue?

Failed test aren't shown, even though Pester knows they exist.

Pester v6.0.0-alpha5

Starting discovery in 1 files.
Discovery found 6 tests in 11ms.
Running tests.

Running tests from ''
[-] <ScriptBlock>:C:\some_path\BeforeAll.Tests.ps1:27 failed with:
RuntimeException: bad error
at <ScriptBlock>, C:\some_path\BeforeAll.Tests.ps1:29
Tests completed in 50ms
Tests Passed: 0, Failed: 6, Skipped: 0, Inconclusive: 0, NotRun: 0
Container failed: 1
  - <ScriptBlock>:C:\some_path\BeforeAll.Tests.ps1:27

Expected Behavior

Pester v6.0.0-alpha5

Starting discovery in 1 files.
Discovery found 6 tests in 83ms.
Running tests.

Running tests from ''
[-] <ScriptBlock>:C:\some_path\BeforeAll.Tests.ps1:27 failed with:
RuntimeException: bad error
at <ScriptBlock>, C:\some_path\BeforeAll.Tests.ps1:29

Describing d1
  [-] i1 90ms (0ms|0ms)
  [-] i2 9ms (0ms|0ms)
 Describing d2
   [-] i3 15ms (0ms|0ms)
   [-] i4 11ms (0ms|0ms)

Describing d3
  [-] i5 15ms (0ms|0ms)
  [-] i6 12ms (0ms|0ms)
Tests completed in 412ms
Tests Passed: 0, Failed: 6, Skipped: 0, Inconclusive: 0, NotRun: 0

Steps To Reproduce

$PesterPreference = [PesterConfiguration]::Default
$PesterPreference.Output.Verbosity = 'Detailed'

$container = New-PesterContainer -ScriptBlock {
    BeforeAll {
        throw 'bad error'
    }
    Describe 'd1' {
        It 'i1' {
            1 | Should -Be 1
        }
        It 'i2' {
            1 | Should -Be 1
        }
        Describe 'd2' {
            It 'i3' {
                1 | Should -Be 1
            }
            It 'i4' {
                1 | Should -Be 1
            }
        }
    }
    Describe 'd3' {
        It 'i5' {
            1 | Should -Be 1
        }
        It 'i6' {
            1 | Should -Be 1
        }
    }
}

Invoke-Pester -Container $container

Describe your environment

Pester version : 6.0.0-alpha5 D:\git\Pester\bin\Pester.psm1
PowerShell version : 5.1.26100.3624
OS version : Microsoft Windows NT 10.0.26100.0

Possible Solution?

I'm open to helping contribute a fix here, probably changes in Output.ps1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions