You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there are two describe blocks (A & B) that have nested BeforeAll steps
If the first Describe block(A) fails and hits and error.
The following desctibe block(B) should be completely skipped.
The issue is that the BeforeAll of the second Describe Block (B) is executed.
Expected Behavior
If there are two describe blocks(A & B) that have nested BeforeAll steps
If the first Describe block(A) fails and hits and error.
The following describe block(B) should be completely skipped.
Specifically: The BeforeAll of the second Describe Block (B) should NOT be executed.
Steps To Reproduce
No response
Describe your environment
The following works - Example 1 without BeforeAll in Describe B:
Example 1 Code:
Describe "A"{
BeforeAll {
Write-Host"Before ALL -A"
}
It "Test 1"{
Write-Host"This is test 1"$a=1$b=2$a| Should -BeExactly $b
}
}
Describe "B"{
It "Test 2"{
Write-Host"This is test 2"
}
}
Example 1 - Output - without BeforeAll in Describe B:
Running tests from'C:\trial.Tests.ps1'
Before ALL -A
Describing A
This is test 1
[-] Test 1 26ms (19ms|7ms)
Expected exactly 2, but got 1.
at $a| Should -BeExactly $b, C:\trial.Tests.ps1:11
at <ScriptBlock>, C:\trial.Tests.ps1:11
Describing B
Skip: (B.Test 2) Test is skipped.
[!] Test 2 10ms (0ms|10ms)
Tests completed in 264ms
Tests Passed: 0, Failed: 1, Skipped: 1 NotRun: 0
Remaining tests skipped after first failure: 1
The following does not run as expected:
Example 2- code - with BeforeAll in Describe B
Describe "A"{
BeforeAll {
Write-Host"Before ALL -A"
}
It "Test 1"{
Write-Host"This is test 1"$a=1$b=2$a| Should -BeExactly $b
}
}
Describe "B"{
BeforeAll {
Write-Host"Before ALL -B"
}
It "Test 2"{
Write-Host"This is test 2"
}
}
Example 2: output - with BeforeAll in Describe B
Running tests from'C:\trial.Tests.ps1'
Before ALL -A
Describing A
This is test 1
[-] Test 1 30ms (21ms|8ms)
Expected exactly 2, but got 1.
at $a| Should -BeExactly $b, C:\trial.Tests.ps1:11
at <ScriptBlock>, C:\trial.Tests.ps1:11
Before ALL -B
Describing B
Skip: (B.Test 2) Test is skipped.
[!] Test 2 11ms (0ms|11ms)
Tests completed in 288ms
Tests Passed: 0, Failed: 1, Skipped: 1 NotRun: 0
Remaining tests skipped after first failure: 1
Possible Solution?
No response
The text was updated successfully, but these errors were encountered:
Thanks, good catch!
Looks like the feature only skipped tests, not blocks, so all BeforeAll/AfterAll will be invoked in both nested and sibling blocks. Will fix this.
Checklist
What is the issue?
Pester v5.3.3
Invoke Pester with:
$config.Run.SkipRemainingOnFailure = "Container"
If there are two describe blocks (A & B) that have nested BeforeAll steps
If the first Describe block(A) fails and hits and error.
The following desctibe block(B) should be completely skipped.
The issue is that the BeforeAll of the second Describe Block (B) is executed.
Expected Behavior
If there are two describe blocks(A & B) that have nested BeforeAll steps
If the first Describe block(A) fails and hits and error.
The following describe block(B) should be completely skipped.
Specifically: The BeforeAll of the second Describe Block (B) should NOT be executed.
Steps To Reproduce
No response
Describe your environment
The following works - Example 1 without BeforeAll in Describe B:
Example 1 Code:
Example 1 - Output - without BeforeAll in Describe B:
The following does not run as expected:
Example 2- code - with BeforeAll in Describe B
Example 2: output - with BeforeAll in Describe B
Possible Solution?
No response
The text was updated successfully, but these errors were encountered: