pester / Pester

Pester is the ubiquitous test and mock framework for PowerShell.

Home Page:https://pester.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SkipRemainingOnFailure does not trigger on block failure

fflaten opened this issue · comments

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 #2424 (comment)