Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Functions/Assertions/Set-TestInconclusive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function Set-TestInconclusive {
.LINK
https://github.com/pester/Pester/wiki/Set%E2%80%90TestInconclusive
#>
[CmdletBinding()]
param (
[string] $Message
)
Expand Down
10 changes: 5 additions & 5 deletions Functions/In.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ The path that the execute block will be executed in.
The script to be executed in the path provided.

#>

param(
$path,
[ScriptBlock] $execute
)
[CmdletBinding()]
param(
$path,
[ScriptBlock] $execute
)
Assert-DescribeInProgress -CommandName In

$old_pwd = $pwd
Expand Down
3 changes: 2 additions & 1 deletion Functions/Mock.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ It
about_Should
about_Mocking
#>

[CmdletBinding()]
param(
[string]$CommandName,
[ScriptBlock]$MockWith={},
Expand Down Expand Up @@ -405,6 +405,7 @@ Assert-VerifiableMocks
This will not throw an exception because the mock was invoked.

#>
[CmdletBinding()]param()
Assert-DescribeInProgress -CommandName Assert-VerifiableMocks

$unVerified=@{}
Expand Down
36 changes: 36 additions & 0 deletions Functions/SetupTeardown.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ function BeforeEach
.LINK
about_BeforeEach_AfterEach
#>
[CmdletBinding()]
param
(
# the scriptblock to execute
[Parameter(Mandatory = $true,
Position = 1)]
[Scriptblock]
$Scriptblock
)
Assert-DescribeInProgress -CommandName BeforeEach
}

Expand All @@ -35,6 +44,15 @@ function AfterEach
.LINK
about_BeforeEach_AfterEach
#>
[CmdletBinding()]
param
(
# the scriptblock to execute
[Parameter(Mandatory = $true,
Position = 1)]
[Scriptblock]
$Scriptblock
)
Assert-DescribeInProgress -CommandName AfterEach
}

Expand All @@ -53,6 +71,15 @@ function BeforeAll
.LINK
about_BeforeEach_AfterEach
#>
[CmdletBinding()]
param
(
# the scriptblock to execute
[Parameter(Mandatory = $true,
Position = 1)]
[Scriptblock]
$Scriptblock
)
Assert-DescribeInProgress -CommandName BeforeAll
}

Expand All @@ -71,6 +98,15 @@ function AfterAll
.LINK
about_BeforeEach_AfterEach
#>
[CmdletBinding()]
param
(
# the scriptblock to execute
[Parameter(Mandatory = $true,
Position = 1)]
[Scriptblock]
$Scriptblock
)
Assert-DescribeInProgress -CommandName AfterAll
}

Expand Down
5 changes: 4 additions & 1 deletion Functions/TestDrive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ function Remove-TestDrive {
}

function Setup {
#included for backwards compatibility
<#
.SYNOPSIS
This command is included in the Pester Mocking framework for backwards compatibility. You do not need to call it directly.
#>
param(
[switch]$Dir,
[switch]$File,
Expand Down
17 changes: 17 additions & 0 deletions Pester.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,23 @@ if ($PSVersionTable.PSVersion.Major -ge 3)
}
}

Describe 'Public API' {
It 'all non-deprecated, non-internal public commands use CmdletBinding' {
$r = Get-Command -Module Pester |
? { $_.CommandType -ne 'Alias' } | # Get-Command outputs aliases in PowerShell 2
? { -not $_.CmdletBinding } |
% { $_.Name } |
? {
@(
'Get-TestDriveItem' # deprecated in 4.0
'SafeGetCommand' # Pester internal
'Setup' # deprecated
) -notcontains $_
}
$r | Should beNullOrEmpty
}
}

Describe 'Style rules' {
$pesterRoot = (Get-Module Pester).ModuleBase

Expand Down