Skip to content

Error in BeforeAll of Data driven tests leads to missing info in the error output #2571

@crlgb

Description

@crlgb

Checklist

What is the issue?

Output does not resolve the current item $_ in the output.

Starting discovery in 1 files.
Discovery found 2 tests in 2ms.
Running tests.
[-] Describe Test <_> failed
 RuntimeException: something
[...]
Tests completed in 24ms
Tests Passed: 0, Failed: 2, Skipped: 0, Inconclusive: 0, NotRun: 0
BeforeAll \ AfterAll failed: 2
  - Test <_>
  - Test <_>

Expected Behavior

Starting discovery in 1 files.
Discovery found 2 tests in 2ms.
Running tests.
[-] Describe Test **a** failed
 RuntimeException: something
[...]
Tests completed in 24ms
Tests Passed: 0, Failed: 2, Skipped: 0, Inconclusive: 0, NotRun: 0
BeforeAll \ AfterAll failed: 2
  - Test **a**
  - Test **b**

Steps To Reproduce

Describe "Test <_>" -ForEach @("a","b") {
  BeforeAll {
    throw "something"
  }
  It "is a or b" {
    $_ | Should -Match "[ab]"
  }
}

Describe your environment

Pester version     : 5.6.1
PowerShell version : 7.4.1
OS version         : Unix 15.0.1

Possible Solution?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions