pester / Pester

Pester is the ubiquitous test and mock framework for PowerShell.
https://pester.dev/
Other
3.07k stars 469 forks source link

SkipRemainingOnFailure does not trigger on block failure #2454

Open fflaten opened 3 months ago

fflaten commented 3 months ago

If the first describe block fails, with using the SkipRemainingOnFailure, I expected the second describe block to NOT execute.

Bug Scenario 2

Describe "TestA"{
    BeforeAll{
         throw "BeforeAll Failure in TestA"
    }
   It "TestA1"{
     Write-Host "Test A1 - It"
   }
}

Describe "TestB" {
  BeforeEach{
      Write-Host "TestB - before all"
  }
  It "TestB2"{
      Write-Host "Test B2 - It"
  }
}

Output:

Describing TestA
[-] Describe TestA failed
  RuntimeException: BeforeAll Failure in TestA
  at <ScriptBlock>, C:\example.Tests.ps1:6

Describing TestB
TestB - before all
Test B2 - It
  [+] TestB2 102ms (86ms|16ms)
Tests completed in 569ms
Tests Passed: 1, Failed: 1, Skipped: 0 NotRun: 0
BeforeAll \ AfterAll failed: 1
  - TestA

Originally posted by @datacore-bwynne in https://github.com/pester/Pester/issues/2424#issuecomment-2110795556