Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump command ref to 5.4.0 #247

Merged
merged 3 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
24 changes: 11 additions & 13 deletions docs/commands/Add-ShouldOperator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,15 @@ This function allows you to create custom Should assertions.
### EXAMPLE 1

```powershell
function BeAwesome($ActualValue, [switch] $Negate)
{
function BeAwesome($ActualValue, [switch] $Negate) {
[bool] $succeeded = $ActualValue -eq 'Awesome'
if ($Negate) { $succeeded = -not $succeeded }

if (-not $succeeded)
{
if ($Negate)
{
if (-not $succeeded) {
if ($Negate) {
$failureMessage = "{$ActualValue} is Awesome"
}
else
{
else {
$failureMessage = "{$ActualValue} is not Awesome"
}
}
Expand All @@ -55,14 +51,16 @@ function BeAwesome($ActualValue, [switch] $Negate)
}
}

Add-ShouldOperator -Name BeAwesome `
-Test $function:BeAwesome `
-Alias 'BA'
Add-ShouldOperator -Name BeAwesome `
-Test $function:BeAwesome `
-Alias 'BA'

PS C:\> "bad" | should -BeAwesome
PS C:\> "bad" | Should -BeAwesome
{bad} is not Awesome
```

Example of how to create a simple custom assertion that checks if the input string is 'Awesome'

## PARAMETERS

### -Name
Expand Down Expand Up @@ -164,4 +162,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/AfterAll.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/AfterEach.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/Assert-MockCalled.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/Assert-VerifiableMock.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/BeforeAll.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/BeforeDiscovery.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/BeforeEach.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
22 changes: 13 additions & 9 deletions docs/commands/Context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,32 @@ apply to tests within that Context .
### EXAMPLE 1

```powershell
function Add-Numbers($a, $b) {
return $a + $b
BeforeAll {
function Add-Numbers($a, $b) {
return $a + $b
}
}

Describe "Add-Numbers" {
Context "when root does not exist" {
It "..." {
Describe 'Add-Numbers' {
Context 'when adding positive values' {
It '...' {
# ...
}
}

Context "when root does exist" {
It "..." {
Context 'when adding negative values' {
It '...' {
# ...
}
It "..." {
It '...' {
# ...
}
}
}
```

Example of how to use Context for grouping different tests

## PARAMETERS

### -Name
Expand Down Expand Up @@ -173,4 +177,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/ConvertTo-JUnitReport.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/ConvertTo-NUnitReport.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/ConvertTo-Pester4Result.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
10 changes: 7 additions & 3 deletions docs/commands/Describe.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ block may contain any number of Context and It blocks.
### EXAMPLE 1

```powershell
function Add-Numbers($a, $b) {
return $a + $b
BeforeAll {
function Add-Numbers($a, $b) {
return $a + $b
}
}

Describe "Add-Numbers" {
Expand All @@ -64,6 +66,8 @@ Describe "Add-Numbers" {
}
```

Using Describe to group tests logically at the root of the script/container

## PARAMETERS

### -Name
Expand Down Expand Up @@ -183,4 +187,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/Export-JUnitReport.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/Export-NUnitReport.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
4 changes: 2 additions & 2 deletions docs/commands/Get-ShouldOperator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Return help examples for the Be assertion operator.

### -Name

{{ Fill Name Description }}
Name or alias of operator

```yaml
Type: String
Expand Down Expand Up @@ -90,4 +90,4 @@ standard PowerShell discovery patterns (like `Get-Help Should -Parameter *`).

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
20 changes: 8 additions & 12 deletions docs/commands/InModuleScope.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ custom_edit_url: null
## SYNOPSIS

Allows you to execute parts of a test script within the
scope of a PowerShell script module.
scope of a PowerShell script or manifest module.

## SYNTAX

Expand All @@ -27,7 +27,7 @@ InModuleScope [-ModuleName] <String> [-ScriptBlock] <ScriptBlock> [[-Parameters]
## DESCRIPTION

By injecting some test code into the scope of a PowerShell
script module, you can use non-exported functions, aliases
script or manifest module, you can use non-exported functions, aliases
and variables inside that module, to perform unit tests on
its internal implementation.

Expand All @@ -40,13 +40,11 @@ either inside or outside a Describe block.

```powershell
# The script module:
function PublicFunction
{
function PublicFunction {
# Does something
}

function PrivateFunction
{
function PrivateFunction {
return $true
}

Expand Down Expand Up @@ -75,13 +73,11 @@ Using InModuleScope allowed this call to

```powershell
# The script module:
function PublicFunction
{
function PublicFunction {
# Does something
}

function PrivateFunction ($MyParam)
{
function PrivateFunction ($MyParam) {
return $MyParam
}

Expand Down Expand Up @@ -141,7 +137,7 @@ Accept wildcard characters: False

### -ScriptBlock

The code to be executed within the script module.
The code to be executed within the script or manifest module.

```yaml
Type: ScriptBlock
Expand Down Expand Up @@ -204,4 +200,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
2 changes: 1 addition & 1 deletion docs/commands/Invoke-Pester.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -649,4 +649,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
18 changes: 13 additions & 5 deletions docs/commands/It.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ command as the first tested statement in the It block.
### EXAMPLE 1

```powershell
function Add-Numbers($a, $b) {
return $a + $b
BeforeAll {
function Add-Numbers($a, $b) {
return $a + $b
}
}

Describe "Add-Numbers" {
Expand All @@ -89,6 +91,9 @@ Describe "Add-Numbers" {
}
```

Example of a simple Pester file.
It-blocks are used to define the different tests.

### EXAMPLE 2

```powershell
Expand All @@ -105,14 +110,17 @@ Describe "Add-Numbers" {
)

It 'Correctly adds \<a\> and \<b\> to get \<expectedResult\>' -TestCases $testCases {
param ($a, $b, $expectedResult)

$sum = Add-Numbers $a $b
$sum | Should -Be $expectedResult
}
}
```

Using It with -TestCases to run the same tests with different parameters and expected results.
Each hashtable in the `$testCases`-array generates one tests to a total of four.
Each key-value pair in the
current hashtable are made available as variables inside It.

## PARAMETERS

### -Name
Expand Down Expand Up @@ -253,4 +261,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## EDIT THIS PAGE

This page was auto-generated using the comment based help in Pester 5.3.3. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
This page was auto-generated using the comment based help in Pester 5.4.0. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information.
Loading