Skip to content

Commit c92e864

Browse files
nohwndfflaten
andauthored
Remove Pending status (#2457)
* Remove Pending status * Update src/functions/Output.ps1 Co-authored-by: Frode Flaten <[email protected]> * Remove output types * Fix tests * Line --------- Co-authored-by: Frode Flaten <[email protected]>
1 parent f4c0f3d commit c92e864

15 files changed

+28
-263
lines changed

src/Main.ps1

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -287,20 +287,6 @@ function Get-AssertionDynamicParams {
287287
return $script:AssertionDynamicParams
288288
}
289289

290-
function Has-Flag {
291-
param
292-
(
293-
[Parameter(Mandatory = $true)]
294-
[Pester.OutputTypes]
295-
$Setting,
296-
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
297-
[Pester.OutputTypes]
298-
$Value
299-
)
300-
301-
0 -ne ($Setting -band $Value)
302-
}
303-
304290
function Invoke-Pester {
305291
<#
306292
.SYNOPSIS
@@ -331,7 +317,7 @@ function Invoke-Pester {
331317
EnableExit parameter to return an exit code that contains the number of failed
332318
tests.
333319
334-
You can also use the Strict parameter to fail all pending and skipped tests.
320+
You can also use the Strict parameter to fail all skipped tests.
335321
This feature is ideal for build systems and other processes that require success
336322
on every test.
337323
@@ -510,7 +496,7 @@ function Invoke-Pester {
510496
(Deprecated v4)
511497
Replace with ConfigurationProperty Output.Verbosity
512498
Customizes the output Pester writes to the screen. Available options are None, Default,
513-
Passed, Failed, Pending, Skipped, Inconclusive, Describe, Context, Summary, Header, All, Fails.
499+
Passed, Failed, Skipped, Inconclusive, Describe, Context, Summary, Header, All, Fails.
514500
The options can be combined to define presets.
515501
ConfigurationProperty Output.Verbosity supports the following values:
516502
None
@@ -535,7 +521,7 @@ function Invoke-Pester {
535521
536522
.PARAMETER Strict
537523
(Deprecated v4)
538-
Makes Pending and Skipped tests to Failed tests. Useful for continuous
524+
Makes Skipped tests to Failed tests. Useful for continuous
539525
integration where you need to make sure all tests passed.
540526
541527
.PARAMETER TagFilter
@@ -663,7 +649,7 @@ function Invoke-Pester {
663649
[object]$PesterOption,
664650

665651
[Parameter(ParameterSetName = "Legacy", DontShow)] # Legacy set for v4 compatibility during migration - deprecated
666-
[Pester.OutputTypes]$Show = 'All'
652+
[String] $Show = 'All'
667653
)
668654
begin {
669655
$start = [DateTime]::Now
@@ -1074,7 +1060,7 @@ function Convert-PesterLegacyParameterSet ($BoundParameters) {
10741060
if ($null -ne $Show) {
10751061
# most used v4 options are adapted, and it also takes v5 options to be able to migrate gradually
10761062
# without switching the whole param set just to get Diagnostic output
1077-
# {None | Default | Passed | Failed | Pending | Skipped | Inconclusive | Describe | Context | Summary | Header | Fails | All}
1063+
# {None | Default | Passed | Failed | Skipped | Inconclusive | Describe | Context | Summary | Header | Fails | All}
10781064
$verbosity = switch ($Show) {
10791065
'All' { 'Detailed' }
10801066
'Default' { 'Detailed' }
@@ -1308,7 +1294,6 @@ function Set-PesterStatistics($Node) {
13081294
$Node.PassedCount += $action.PassedCount
13091295
$Node.FailedCount += $action.FailedCount
13101296
$Node.SkippedCount += $action.SkippedCount
1311-
$Node.PendingCount += $action.PendingCount
13121297
$Node.InconclusiveCount += $action.InconclusiveCount
13131298
}
13141299
elseif ($action.Type -eq 'TestCase') {
@@ -1324,9 +1309,6 @@ function Set-PesterStatistics($Node) {
13241309
Skipped {
13251310
$Node.SkippedCount++; break;
13261311
}
1327-
Pending {
1328-
$Node.PendingCount++; break;
1329-
}
13301312
Inconclusive {
13311313
$Node.InconclusiveCount++; break;
13321314
}
@@ -1393,7 +1375,6 @@ function ConvertTo-Pester4Result {
13931375
PassedCount = 0
13941376
FailedCount = 0
13951377
SkippedCount = 0
1396-
PendingCount = 0
13971378
InconclusiveCount = 0
13981379
Time = [TimeSpan]::Zero
13991380
TestResult = [System.Collections.Generic.List[object]]@()
@@ -1463,7 +1444,6 @@ function ConvertTo-Pester4Result {
14631444
}
14641445
}
14651446
$legacyResult.TotalCount = $legacyResult.TestResult.Count
1466-
$legacyResult.PendingCount = 0
14671447
$legacyResult.Time = $PesterResult.Duration
14681448

14691449
$legacyResult

src/Pester.Runtime.ps1

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ function Invoke-TestItem {
681681

682682
$Test.FrameworkData.Runtime.ExecutionStep = 'Finished'
683683

684-
if (@('PesterTestSkipped', 'PesterTestInconclusive', 'PesterTestPending') -contains $Result.ErrorRecord.FullyQualifiedErrorId) {
684+
if (@('PesterTestSkipped', 'PesterTestInconclusive') -contains $Result.ErrorRecord.FullyQualifiedErrorId) {
685685
#Same logic as when setting a test block to skip
686686
if ($PesterPreference.Debug.WriteDebugMessages.Value) {
687687
$path = $Test.Path -join '.'
@@ -693,12 +693,6 @@ function Invoke-TestItem {
693693
}
694694
else {
695695
$Test.Skipped = $true
696-
697-
# Pending test is still considered a skipped, we don't have a special category for it.
698-
# Mark the run to show deprecation message.
699-
if ('PesterTestPending' -eq $Result.ErrorRecord.FullyQualifiedErrorId) {
700-
$test.Block.Root.FrameworkData['ShowPendingDeprecation'] = $true
701-
}
702696
}
703697
}
704698
else {

src/csharp/Pester/Block.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,13 @@ public Block()
8383
public Hashtable FrameworkData { get; set; } = new Hashtable();
8484
public Hashtable PluginData { get; set; } = new Hashtable();
8585

86-
public int PendingCount { get; set; }
8786
public int InconclusiveCount { get; set; }
8887

8988
public bool OwnPassed { get; set; }
9089
public int OwnTotalCount { get; set; }
9190
public int OwnPassedCount { get; set; }
9291
public int OwnFailedCount { get; set; }
9392
public int OwnSkippedCount { get; set; }
94-
public int OwnPendingCount { get; set; }
9593
public int OwnNotRunCount { get; set; }
9694
public int OwnInconclusiveCount { get; set; }
9795

src/csharp/Pester/OutputTypes.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/functions/Coverage.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ function Get-JaCoCoReportXml {
815815

816816
$isGutters = "CoverageGutters" -eq $Format
817817

818-
if ($null -eq $CoverageReport -or ($pester.Show -eq [Pester.OutputTypes]::None) -or $CoverageReport.NumberOfCommandsAnalyzed -eq 0) {
818+
if ($null -eq $CoverageReport -or ('None' -eq $pester.Show) -or $CoverageReport.NumberOfCommandsAnalyzed -eq 0) {
819819
return [string]::Empty
820820
}
821821

src/functions/It.ps1

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@
2727
AAA pattern (Arrange-Act-Assert), this typically holds the
2828
Assert.
2929
30-
.PARAMETER Pending
31-
Use this parameter to explicitly mark the test as work-in-progress/not implemented/pending when you
32-
need to distinguish a test that fails because it is not finished yet from a tests
33-
that fail as a result of changes being made in the code base. An empty test, that is a
34-
test that contains nothing except whitespace or comments is marked as Pending by default.
35-
3630
.PARAMETER Skip
3731
Use this parameter to explicitly mark the test to be skipped. This is preferable to temporarily
3832
commenting out a test, because the test remains listed in the output.
@@ -133,9 +127,6 @@
133127

134128
[String[]] $Tag,
135129

136-
[Parameter(ParameterSetName = 'Pending')]
137-
[Switch] $Pending,
138-
139130
[Parameter(ParameterSetName = 'Skip')]
140131
[Switch] $Skip
141132

@@ -146,12 +137,6 @@
146137
)
147138

148139
$Focus = $false
149-
if ($PSBoundParameters.ContainsKey('Pending')) {
150-
$PSBoundParameters.Remove('Pending')
151-
152-
$Skip = $Pending
153-
# $SkipBecause = "This test is pending."
154-
}
155140

156141
if ($null -eq $Test) {
157142
if ($Name.Contains("`n")) {

src/functions/Output.ps1

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ $script:ReportStrings = DATA {
2727
TestsPassed = 'Tests Passed: {0}, '
2828
TestsFailed = 'Failed: {0}, '
2929
TestsSkipped = 'Skipped: {0}, '
30-
TestsPending = 'Pending: {0}, '
3130
TestsInconclusive = 'Inconclusive: {0}, '
3231
TestsNotRun = 'NotRun: {0}'
3332
}
@@ -46,8 +45,6 @@ $script:ReportTheme = DATA {
4645
FailDetail = 'Red'
4746
Skipped = 'Yellow'
4847
SkippedTime = 'DarkGray'
49-
Pending = 'Gray'
50-
PendingTime = 'DarkGray'
5148
NotRun = 'Gray'
5249
NotRunTime = 'DarkGray'
5350
Total = 'Gray'
@@ -235,7 +232,7 @@ function ConvertTo-PesterResult {
235232
return $testResult
236233
}
237234

238-
if (@('PesterAssertionFailed', 'PesterTestSkipped', 'PesterTestInconclusive', 'PesterTestPending') -contains $ErrorRecord.FullyQualifiedErrorID) {
235+
if (@('PesterAssertionFailed', 'PesterTestSkipped', 'PesterTestInconclusive') -contains $ErrorRecord.FullyQualifiedErrorID) {
239236
# we use TargetObject to pass structured information about the error.
240237
$details = $ErrorRecord.TargetObject
241238

@@ -249,9 +246,6 @@ function ConvertTo-PesterResult {
249246
PesterTestInconclusive {
250247
$testResult.Result = 'Inconclusive'; break;
251248
}
252-
PesterTestPending {
253-
$testResult.Result = 'Pending'; break;
254-
}
255249
PesterTestSkipped {
256250
$testResult.Result = 'Skipped'; break;
257251
}
@@ -277,7 +271,6 @@ function Write-PesterReport {
277271
[Parameter(mandatory = $true, valueFromPipeline = $true)]
278272
[Pester.Run] $RunResult
279273
)
280-
# if(-not ($PesterState.Show | Has-Flag Summary)) { return }
281274

282275
Write-PesterHostMessage ($ReportStrings.Timing -f (Get-HumanTime ($RunResult.Duration))) -Foreground $ReportTheme.Foreground
283276

@@ -309,12 +302,6 @@ function Write-PesterReport {
309302
$ReportTheme.Information
310303
}
311304

312-
# $Pending = if ($RunResult.PendingCount -gt 0) {
313-
# $ReportTheme.Pending
314-
# }
315-
# else {
316-
# $ReportTheme.Information
317-
# }
318305
$Inconclusive = if ($RunResult.InconclusiveCount -gt 0) {
319306
$ReportTheme.Inconclusive
320307
}
@@ -360,18 +347,6 @@ function Write-PesterReport {
360347
Write-PesterHostMessage ('Container failed: {0}' -f $RunResult.FailedContainersCount) -Foreground $ReportTheme.Fail
361348
Write-PesterHostMessage ($cs -join [Environment]::NewLine) -Foreground $ReportTheme.Fail
362349
}
363-
# & $SafeCommands['Write-Host'] ($ReportStrings.TestsPending -f $RunResult.PendingCount) -Foreground $Pending -NoNewLine
364-
# & $SafeCommands['Write-Host'] ($ReportStrings.TestsInconclusive -f $RunResult.InconclusiveCount) -Foreground $Inconclusive
365-
# }
366-
367-
$rootFrameworkData = @($RunResult.Containers.Blocks.Root.FrameworkData)
368-
foreach ($frameworkData in $rootFrameworkData) {
369-
if ($null -ne $frameworkData -and $frameworkData['ShowPendingDeprecation']) {
370-
Write-PesterHostMessage '**DEPRECATED**: The -Pending parameter of Set-ItResult is deprecated. The parameter will be removed in a future version of Pester.' -ForegroundColor $ReportTheme.Warning
371-
# Show it only once.
372-
break
373-
}
374-
}
375350
}
376351

377352
function Write-CoverageReport {
@@ -713,7 +688,7 @@ function Get-WriteScreenPlugin ($Verbosity) {
713688
$margin = $ReportStrings.Margin * ($level)
714689
$error_margin = $margin + $ReportStrings.Margin
715690
$out = $_test.ExpandedName
716-
if (-not $_test.Skip -and @('PesterTestSkipped', 'PesterTestInconclusive', 'PesterTestPending') -contains $Result.ErrorRecord.FullyQualifiedErrorId) {
691+
if (-not $_test.Skip -and @('PesterTestSkipped', 'PesterTestInconclusive') -contains $Result.ErrorRecord.FullyQualifiedErrorId) {
717692
$skippedMessage = [String]$_Test.ErrorRecord
718693
[String]$out += " $skippedMessage"
719694
}
@@ -789,16 +764,6 @@ function Get-WriteScreenPlugin ($Verbosity) {
789764
break
790765
}
791766

792-
Pending {
793-
if ($PesterPreference.Output.Verbosity.Value -in 'Detailed', 'Diagnostic') {
794-
$because = if ($_test.FailureMessage) { ", because $($_test.FailureMessage)" } else { $null }
795-
Write-PesterHostMessage -ForegroundColor $ReportTheme.Pending "$margin[?] $out" -NoNewLine
796-
Write-PesterHostMessage -ForegroundColor $ReportTheme.Pending ", is pending$because" -NoNewLine
797-
Write-PesterHostMessage -ForegroundColor $ReportTheme.PendingTime " $humanTime"
798-
}
799-
break
800-
}
801-
802767
Inconclusive {
803768
if ($PesterPreference.Output.Verbosity.Value -in 'Detailed', 'Diagnostic') {
804769
$because = if ($_test.FailureMessage) { ", because $($_test.FailureMessage)" } else { $null }

src/functions/Set-ItResult.ps1

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,13 @@
77
Sometimes a test shouldn't be executed, sometimes the condition cannot be evaluated.
88
By default such tests would typically fail and produce a big red message.
99
Using Set-ItResult it is possible to set the result from the inside of the It script
10-
block to either inconclusive, pending or skipped.
11-
12-
As of Pester 5, there is no "Inconclusive" or "Pending" test state, so all tests will now go to state skipped,
13-
however the test result notes will include information about being inconclusive or testing to keep this command
14-
backwards compatible
10+
block to either inconclusive, or skipped.
1511
1612
.PARAMETER Inconclusive
17-
Sets the test result to inconclusive. Cannot be used at the same time as -Pending or -Skipped
18-
19-
.PARAMETER Pending
20-
**DEPRECATED** Sets the test result to pending. Cannot be used at the same time as -Inconclusive or -Skipped
13+
Sets the test result to inconclusive. Cannot be used at the same time as -Skipped
2114
2215
.PARAMETER Skipped
23-
Sets the test result to skipped. Cannot be used at the same time as -Inconclusive or -Pending
16+
Sets the test result to skipped. Cannot be used at the same time as -Inconclusive.
2417
2518
.PARAMETER Because
2619
Similarly to failing tests, skipped and inconclusive tests should have reason. It allows
@@ -54,7 +47,6 @@
5447
[CmdletBinding()]
5548
param(
5649
[Parameter(Mandatory = $false, ParameterSetName = "Inconclusive")][switch]$Inconclusive,
57-
[Parameter(Mandatory = $false, ParameterSetName = "Pending")][switch]$Pending,
5850
[Parameter(Mandatory = $false, ParameterSetName = "Skipped")][switch]$Skipped,
5951
[string]$Because
6052
)
@@ -81,11 +73,6 @@
8173
[String]$message = "is inconclusive"
8274
break
8375
}
84-
'Pending' {
85-
[String]$errorId = 'PesterTestPending'
86-
[String]$message = "is pending"
87-
break
88-
}
8976
'Skipped' {
9077
[String]$errorId = 'PesterTestSkipped'
9178
[String]$message = "is skipped"

src/functions/TestResults.NUnit25.ps1

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ function Get-ParameterizedTestSuiteInfo {
159159
PassedCount = 0
160160
FailedCount = 0
161161
SkippedCount = 0
162-
PendingCount = 0
163162
InconclusiveCount = 0
164163
}
165164

@@ -175,9 +174,6 @@ function Get-ParameterizedTestSuiteInfo {
175174
Skipped {
176175
$node.SkippedCount++; break;
177176
}
178-
Pending {
179-
$node.PendingCount++; break;
180-
}
181177
Inconclusive {
182178
$node.InconclusiveCount++; break;
183179
}
@@ -330,20 +326,6 @@ function Write-NUnitTestCaseAttributes {
330326
break
331327
}
332328

333-
Pending {
334-
$XmlWriter.WriteAttributeString('result', 'Inconclusive')
335-
$XmlWriter.WriteAttributeString('executed', 'True')
336-
337-
# TODO: This doesn't work, FailureMessage comes from Get-ErrorForXmlReport which isn't called
338-
if ($TestResult.FailureMessage) {
339-
$XmlWriter.WriteStartElement('reason')
340-
$xmlWriter.WriteElementString('message', $TestResult.FailureMessage)
341-
$XmlWriter.WriteEndElement() # Close reason tag
342-
}
343-
344-
break
345-
}
346-
347329
Inconclusive {
348330
$XmlWriter.WriteAttributeString('result', 'Inconclusive')
349331
$XmlWriter.WriteAttributeString('executed', 'True')
@@ -384,9 +366,6 @@ function Get-GroupResult ($InputObject) {
384366
if ($InputObject.SkippedCount -gt 0) {
385367
return 'Ignored'
386368
}
387-
if ($InputObject.PendingCount -gt 0) {
388-
return 'Inconclusive'
389-
}
390369
if ($InputObject.InconclusiveCount -gt 0) {
391370
return 'Inconclusive'
392371
}

0 commit comments

Comments
 (0)