-
-
Notifications
You must be signed in to change notification settings - Fork 478
Open
Description
Checklist
- Issue has a meaningful title
- I have searched the existing issues. See all issues
- I have tested using the latest version of Pester. See Installation and update guide.
What is the issue?
Not sure whether this is a PowerShell a bug or feature but fixing it in PowerShell would probably be a break change.
A side effect of this "feature" is also that it breaks all running Pester tests:
Actual behavior
Starting discovery in 1 files.
Discovery found 3 tests in 47ms.
Running tests.
(no further results)
Expected Behavior
Starting discovery in 1 files.
Discovery found 3 tests in 38ms.
Running tests.
[-] Describe.Context.It 1 27ms (27ms|0ms)
Expected $null or empty, but got 1.
at Test 1 | Should -BeNullOrEmpty, C:\Users\Gebruiker\OneDrive\Scripts\PowerShell\PowerSnippets\ObjectGraph\ObjectGraphTools\_Temp\Test\Pester\Test.ps1:13
at <ScriptBlock>, C:\Users\Gebruiker\OneDrive\Scripts\PowerShell\PowerSnippets\ObjectGraph\ObjectGraphTools\_Temp\Test\Pester\Test.ps1:13
[-] Describe.Context.It 2 37ms (36ms|1ms)
Expected $null or empty, but got @(1, 2).
at Test 2 | Should -BeNullOrEmpty, C:\Users\Gebruiker\OneDrive\Scripts\PowerShell\PowerSnippets\ObjectGraph\ObjectGraphTools\_Temp\Test\Pester\Test.ps1:17
at <ScriptBlock>, C:\Users\Gebruiker\OneDrive\Scripts\PowerShell\PowerSnippets\ObjectGraph\ObjectGraphTools\_Temp\Test\Pester\Test.ps1:17
[-] Describe.Context.It 3 28ms (27ms|1ms)
Expected $null or empty, but got @(1, 2, 3).
at Test 3 | Should -BeNullOrEmpty, C:\Users\Gebruiker\OneDrive\Scripts\PowerShell\PowerSnippets\ObjectGraph\ObjectGraphTools\_Temp\Test\Pester\Test.ps1:21
at <ScriptBlock>, C:\Users\Gebruiker\OneDrive\Scripts\PowerShell\PowerSnippets\ObjectGraph\ObjectGraphTools\_Temp\Test\Pester\Test.ps1:21
Tests completed in 282ms
Tests Passed: 0, Failed: 3, Skipped: 0 NotRun: 0
Or at least:
Tests completed in ...
Tests Passed: ..., Failed: ..., Skipped: ... NotRun: ...
Or an error message
Steps To Reproduce
Function Test($b) {
:foo foreach ($a in 1,2,3) {
$a
if ($a -ge $b) { break bar }
}
}
Describe 'Describe' {
Context 'Context' {
It 'It 1' {
Test 1 | Should -BeNullOrEmpty
}
It 'It 2' {
Test 2 | Should -BeNullOrEmpty
}
It 'It 3' {
Test 3 | Should -BeNullOrEmpty
}
}
}Describe your environment
Pester version : 5.5.0 C:\Users\Gebruiker\Documents\PowerShell\Modules\Pester\5.5.0\Pester.psm1
PowerShell version : 7.5.4
OS version : Microsoft Windows NT 10.0.26100.0
Possible Solution?
Check for unknown labels during discovery?
Metadata
Metadata
Assignees
Labels
No labels