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
BeforeAll and AfterAll are not executed on skipped blocks when explicitly running a test, e.g. using Filter.Line option. See highlighted lines below which are missing.
Expected Behavior
Discovery found 2 tests in 23ms.
Filter 'Line' set to ('C:\Users\Frode\Git\Pester/demoBlockSkip.tests.ps1:18').
Filters selected 1 tests to run.
Discovery: Test discovery finished.
Running tests.
Running tests from 'C:\Users\Frode\Git\Pester\demoBlockSkip.tests.ps1'
Before ALL ROOT
+Before ALL -A+Before ALL -B
Describing A
Describing B
Before EACH -A
Before EACH -B
This is test 2
After EACH -B
After EACH -A
[+] Test 2 27ms (24ms|4ms)
+After ALL -B+After ALL -A
After ALL ROOT
Tests completed in 101ms
Tests Passed: 1, Failed: 0, Skipped: 0, Inconclusive: 0, NotRun: 1
Steps To Reproduce
demoBlockSkip.tests.ps1
BeforeAll { Write-Host'Before ALL ROOT' }
AfterAll { Write-Host'After ALL ROOT' }
Describe 'A'-Skip {
BeforeAll { Write-Host'Before ALL -A' }
AfterAll { Write-Host'After ALL -A' }
BeforeEach { Write-Host'Before EACH -A' }
AfterEach { Write-Host'After EACH -A' }
It 'Test 1'-Skip { Write-Host'This is test 1' }
Describe 'B' {
BeforeAll { Write-Host'Before ALL -B' }
AfterAll { Write-Host'After ALL -B' }
BeforeEach { Write-Host'Before EACH -B' }
AfterEach { Write-Host'After EACH -B' }
It 'Test 2'-Skip { Write-Host'This is test 2' }
}
}
Pester version : 5.6.0-beta1 C:\Users\Frode\Documents\PowerShell\Modules\pester\5.6.0\Pester.psm1
PowerShell version : 7.4.2
OS version : Microsoft Windows NT 10.0.22631.0
Possible Solution?
Will be fixed by #2447 by setting Skip to false on blocks with child blocks/tests that will be executed. The logic needs to occur after evaluating all tests for explicit include recursively as tests usually inherit skip from parent block.
The text was updated successfully, but these errors were encountered:
fflaten
changed the title
BeforeAll and AfterAll not invoked when running skipped test explicitly
BeforeAll and AfterAll not invoked on skipped blocks when running test explicitly
May 13, 2024
Checklist
What is the issue?
BeforeAll
andAfterAll
are not executed on skipped blocks when explicitly running a test, e.g. usingFilter.Line
option. See highlighted lines below which are missing.Expected Behavior
Steps To Reproduce
demoBlockSkip.tests.ps1
demoBlockSkip.ps1
Describe your environment
Pester version : 5.6.0-beta1 C:\Users\Frode\Documents\PowerShell\Modules\pester\5.6.0\Pester.psm1
PowerShell version : 7.4.2
OS version : Microsoft Windows NT 10.0.22631.0
Possible Solution?
Will be fixed by #2447 by setting
Skip
to false on blocks with child blocks/tests that will be executed. The logic needs to occur after evaluating all tests for explicit include recursively as tests usually inherit skip from parent block.The text was updated successfully, but these errors were encountered: