Format-Pester
Format-Pester copied to clipboard
Enhancement request: Support nested context with associated it blocks
I have tested the following script to test nested Pester Context blocks:
#pester nested context test with 4.0.3
describe "Nested Context Test with Pester 4.0.3" {
context "Context #1" {
it "will test foo" {
'foo' | should be foo
}
context "nested contex 1" {
it "will test foo again" {
'foo' | should not be foo
}
}
}
}
And pester fully supports it:
Executing all tests in .\pester-test.ps1
Executing script .\pester-test.ps1
Describing Nested Context Test with Pester 4.0.3
Context Context #1
[+] will test foo 517ms
Context nested contex 1
[-] will test foo again 182ms
Expected: value was {foo}, but should not have been the same
at <ScriptBlock>, C:\temp\pester\pester-test.ps1: line 18
18: 'foo' | should not be foo
Tests completed in 699ms
Tests Passed: 1, Failed: 1, Skipped: 0, Pending: 0, Inconclusive: 0
However, Format-Pester results does not handle the nested context blocks in the report generated. Can you please add support for this pester feature?
We will consider it. Pull requests are welcomed!