Skip to content

Commit 8b2ff42

Browse files
fflatenmharrah
andauthored
Misc updates to docs (#309)
* Update Skip with note about inconclusive and Set-ItResult * Cleanup formatting * Update breaking changes in v5 page to match recent versions * Update skip.mdx * Update v5 docs * Backport ebffe74 to v5 docs Co-Authored-By: Matthew Harrah <mharrah@paylocity.com> --------- Co-authored-by: Matthew Harrah <mharrah@paylocity.com>
1 parent 9a163cb commit 8b2ff42

File tree

8 files changed

+67
-63
lines changed

8 files changed

+67
-63
lines changed

docs/migrations/breaking-changes-in-v5.mdx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,36 @@ description: Pester v5 included an all-new runtime which lead to some breaking c
66

77
## Actual breaking changes
88

9-
- The Parameters of `Invoke-Pester` changed significantly, but in 5.0.1, a compatibility parameter set was added. To allow all the v4 parameters to be used, e.g. like this `Invoke-Pester -Script $testFile -PassThru -Verbose -OutputFile $tr -OutputFormat NUnitXml -CodeCoverage "$tmp/*-*.ps1" -CodeCoverageOutputFile $cc -Show All`. The compatibility is not 100%, neither -Script not -CodeCoverage take hashtables, they just take a collection of paths. The `-Strict` parameter and `-PesterOption` are ignored. The `-Output` \ `-Show` parameter takes all the values, but translates only the most used options to Pester 5 compatible options, otherwise it uses `Detailed` output. It also allows all the Pester 5 output options, to allow you to use `Diagnostic` during migration. **This whole Legacy-parameter set is deprecated** and prints a warning when used. For more options and the Advanced interface see [simple and advanced interface](./v4-to-v5#simple-and-advanced-interface) above on how to invoke Pester.
9+
- The Parameters of `Invoke-Pester` changed significantly, but a compatibility parameter set was added to allow all the v4 parameters to be used, e.g. like this `Invoke-Pester -Script $testFile -PassThru -Verbose -OutputFile $tr -OutputFormat NUnitXml -CodeCoverage "$tmp/*-*.ps1" -CodeCoverageOutputFile $cc -Show All`. Be aware of these limitations and notes:
10+
- The compatibility is not 100%, neither `-Script` not `-CodeCoverage` take hashtables, they just take a collection of paths.
11+
- The `-Strict` parameter and `-PesterOption` are ignored.
12+
- The `-Output` \ `-Show` parameter takes all the values, but translates only the most used options to Pester 5 compatible options, otherwise it uses `Detailed` output. It also allows all the Pester 5 output options, to allow you to use `Diagnostic` during migration.
13+
- **This whole Legacy-parameter set is deprecated** and prints a warning when used. For more options and the Advanced interface see [simple and advanced interface](./v4-to-v5#simple-and-advanced-interface) above on how to invoke Pester.
1014
- PowerShell 2 is no longer supported
1115
- Legacy syntax `Should Be` (without `-`) is removed, see [Migrating from Pester v3 to v4](./v3-to-v4)
1216
- Mocks are scoped based on their placement, not in whole `Describe` / `Context`. The count also depends on their placement. See [mock scoping](../usage/mocking#mocks-are-scoped-based-on-their-placement)
1317
- `Assert-VerifiableMocks` was removed, see [Should -Invoke](../usage/mocking#should--invoke)
1418
- All code placed in the body of `Describe` outside of `It`, `BeforeAll`, `BeforeEach`, `AfterAll`, `AfterEach` will run during discovery and it's state might or might not be available to the test code, see [Discovery and Run](../usage/discovery-and-run)
15-
16-
- `-Output` parameter has reduced options to `None`, `Normal`, `Detailed` and `Diagnostic`, `-Show` alias is removed
19+
- `-Output` parameter has reduced options to `None`, `Normal`, `Detailed` and `Diagnostic`. `-Show` alias is removed
1720
- `-PesterOption` switch is removed
1821
- `-TestName` switch is replaced with `-FullNameFilter` switch
1922
- `-Script` option was renamed to `-Path` and takes paths only, it does not take hashtables. For parametrized scripts, see [Providing external data to tests](../usage/data-driven-tests#providing-external-data-to-tests)
2023
- Using `$MyInvocation.MyCommand.Path` to locate your script in `BeforeAll` does not work. This does not break it for your scripts and modules. Use `$PSScriptRoot` or `$PSCommandPath`. See [Migrating from Pester v4](../usage/importing-tested-functions#migrating-from-pester-v4) or the [importing ps files](https://jakubjares.com/2020/04/11/pester5-importing-ps-files/) article for detailed information.
2124
- Should `-Throw` is using `-like` to match the exception message instead of .Contains. Use `*` or any of the other `-like` wildcard to match only part of the message.
22-
- Variables defined during Discovery, are not available in Before*, After* and It. When generating tests via foreach blocks, make sure you pass all variables into the test using -TestCases / -ForEach.
23-
- Gherkin is removed, and will later move to it's own module, please keep using Pester version 4.
24-
- `TestDrive` is defined during Run only, it cannot be used in -TestCases / -ForEach.
25+
- Variables defined during Discovery, are not available in `BeforeAll/-Each`, `AfterAll/-Each` and `It`. When generating tests via foreach blocks, make sure you pass all variables into the test using `-ForEach`.
26+
- Gherkin is removed, please keep using Pester version 4.
27+
- `TestDrive` is defined during Run only, it cannot be used in `-ForEach`.
2528

2629
### Deprecated features
2730

28-
- `Assert-MockCalled` is deprecated, it is recommended to use [Should -Invoke](../usage/mocking)
29-
- `Assert-VerifiableMock` is deprecated, it is recommended to use [Should -InvokeVerifiable](../usage/mocking)
31+
- `Assert-MockCalled` is deprecated, it is recommended to use [Should -Invoke](../usage/mocking).
32+
- `Assert-VerifiableMock` is deprecated, it is recommended to use [Should -InvokeVerifiable](../usage/mocking).
33+
- Pending state (`Set-ItResult -Pending`) is deprecated and will be removed in a future version.
3034

3135
### Additional issues to be solved future releases
3236

3337
- `-Strict` switch is not available
34-
- Inconclusive and Pending states are currently no longer available, `-Pending` and `-Inconclusive` are translated to `-Skip` both on test blocks and when using `Set-ItResult`
35-
- Automatic Code coverage via -CI switch currently disabled as it's slow. Can still be enabled using configuration, but is largely untested.
36-
- Generating tests using foreach during discovery time works mostly, generating them from BeforeAll, to postpone expensive work till it is needed in case the test is filtered out also works, but is hacky. Get in touch if you need it and help me refine it.
37-
- Running on huge codebases is largely untested
38+
- Automatic Code coverage via -CI switch currently disabled as it's slow. Can still be enabled using configuraitonis largely untested.
39+
3840

3941
**Noticed more of them? Share please!**

docs/migrations/v4-to-v5.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,18 @@ The following table shows a mapping of v4 Legacy parameters (those which have no
138138

139139
</div>
140140

141-
The following table shows the mapping for v4 *Show* property values to the configuration property *Output.Verbosity*:
141+
The following table shows the mapping for v4 `-Show` property values to the configuration property `Output.Verbosity`:
142142

143-
| *Show* value | Configuration Object *Output Verbosity* Property |
144-
| ------------ | ------------------------------------------------ |
145-
| All | Detailed |
146-
| Default | Detailed |
147-
| Detailed | Detailed |
148-
| Fails | Normal |
149-
| Diagnostic | Diagnostic |
150-
| Normal | Normal |
151-
| Minimal | Minimal |
152-
| None | None |
143+
| `-Show` Value | `Output.Verbosity` Property |
144+
| ------------- | ----------------------------|
145+
| All | Detailed |
146+
| Default | Detailed |
147+
| Detailed | Detailed |
148+
| Fails | Normal |
149+
| Diagnostic | Diagnostic |
150+
| Normal | Normal |
151+
| Minimal | Minimal |
152+
| None | None |
153153

154154

155155
### Implicit parameters for TestCases
@@ -170,7 +170,7 @@ This also works for Mock.
170170

171171
#### Mocks can be debugged
172172

173-
Mocks don't rewrite the scriptblock you provide anymore. You can now set breakpoints into them as well as any of the ParameterFilter or Should -Invoke Parameter filter.
173+
Mocks don't rewrite the scriptblock you provide anymore. You can now set breakpoints into them as well as any of the `-ParameterFilter` used in `Mock` and `Should -Invoke`.
174174

175175
#### Avoid putting in InModuleScope around your Describe and It blocks
176176

docs/usage/skip.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,9 @@ Tests completed in 1.03s
5454
Tests Passed: 1, Failed: 0, Skipped: 4, Total: 5, NotRun: 0
5555
```
5656

57-
:::warning
58-
Pending is translated to skipped, Inconclusive does not exist anymore.
59-
:::
60-
6157
### Conditional skip
6258

63-
Evaluation of the skip-parameter is done as part of the Discovery-phase. This means you can also dynamically skip tests based on values available in that phase. Either as logic done in BeforeDiscovery or based on values passed into a parametrized test.
59+
Evaluation of the skip-parameter is done as part of the Discovery-phase. This means you can also dynamically skip tests based on values available in that phase. Either as logic done in `BeforeDiscovery` or based on values passed into a parametrized test.
6460

6561
```powershell
6662
$sb = {
@@ -126,3 +122,7 @@ Describing My Describe Block
126122
Tests completed in 206ms
127123
Tests Passed: 1, Failed: 0, Skipped: 2 NotRun: 0
128124
```
125+
126+
:::tip Skipping during Run-phase
127+
In certain scenarios you might need to mark a test as skipped or inconclusive during execution. This is possible using [`Set-ItResult`](../commands/Set-ItResult). Be aware that setup and teardown-blocks will be executed, so use `-Skip` whenever possible.
128+
:::

versioned_docs/version-v5/migrations/breaking-changes-in-v5.mdx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,36 @@ description: Pester v5 included an all-new runtime which lead to some breaking c
66

77
## Actual breaking changes
88

9-
- (❗ new in 5.0.1) The Parameters of `Invoke-Pester` changed significantly, but in 5.0.1, a compatibility parameter set was added. To allow all the v4 parameters to be used, e.g. like this `Invoke-Pester -Script $testFile -PassThru -Verbose -OutputFile $tr -OutputFormat NUnitXml -CodeCoverage "$tmp/*-*.ps1" -CodeCoverageOutputFile $cc -Show All`. The compatibility is not 100%, neither -Script not -CodeCoverage take hashtables, they just take a collection of paths. The `-Strict` parameter and `-PesterOption` are ignored. The `-Output` \ `-Show` parameter takes all the values, but translates only the most used options to Pester 5 compatible options, otherwise it uses `Detailed` output. It also allows all the Pester 5 output options, to allow you to use `Diagnostic` during migration. **This whole Legacy-parameter set is deprecated** and prints a warning when used. For more options and the Advanced interface see [simple and advanced interface](./v4-to-v5#simple-and-advanced-interface) above on how to invoke Pester.
9+
- The Parameters of `Invoke-Pester` changed significantly, but a compatibility parameter set was added to allow all the v4 parameters to be used, e.g. like this `Invoke-Pester -Script $testFile -PassThru -Verbose -OutputFile $tr -OutputFormat NUnitXml -CodeCoverage "$tmp/*-*.ps1" -CodeCoverageOutputFile $cc -Show All`. Be aware of these limitations and notes:
10+
- The compatibility is not 100%, neither `-Script` not `-CodeCoverage` take hashtables, they just take a collection of paths.
11+
- The `-Strict` parameter and `-PesterOption` are ignored.
12+
- The `-Output` \ `-Show` parameter takes all the values, but translates only the most used options to Pester 5 compatible options, otherwise it uses `Detailed` output. It also allows all the Pester 5 output options, to allow you to use `Diagnostic` during migration.
13+
- **This whole Legacy-parameter set is deprecated** and prints a warning when used. For more options and the Advanced interface see [simple and advanced interface](./v4-to-v5#simple-and-advanced-interface) above on how to invoke Pester.
1014
- PowerShell 2 is no longer supported
1115
- Legacy syntax `Should Be` (without `-`) is removed, see [Migrating from Pester v3 to v4](./v3-to-v4)
1216
- Mocks are scoped based on their placement, not in whole `Describe` / `Context`. The count also depends on their placement. See [mock scoping](../usage/mocking#mocks-are-scoped-based-on-their-placement)
1317
- `Assert-VerifiableMocks` was removed, see [Should -Invoke](../usage/mocking#should--invoke)
1418
- All code placed in the body of `Describe` outside of `It`, `BeforeAll`, `BeforeEach`, `AfterAll`, `AfterEach` will run during discovery and it's state might or might not be available to the test code, see [Discovery and Run](../usage/discovery-and-run)
15-
16-
- `-Output` parameter has reduced options to `None`, `Normal`, `Detailed` and `Diagnostic`, `-Show` alias is removed
19+
- `-Output` parameter has reduced options to `None`, `Normal`, `Detailed` and `Diagnostic`. `-Show` alias is removed
1720
- `-PesterOption` switch is removed
1821
- `-TestName` switch is replaced with `-FullNameFilter` switch
1922
- `-Script` option was renamed to `-Path` and takes paths only, it does not take hashtables. For parametrized scripts, see [Providing external data to tests](../usage/data-driven-tests#providing-external-data-to-tests)
2023
- Using `$MyInvocation.MyCommand.Path` to locate your script in `BeforeAll` does not work. This does not break it for your scripts and modules. Use `$PSScriptRoot` or `$PSCommandPath`. See [Migrating from Pester v4](../usage/importing-tested-functions#migrating-from-pester-v4) or the [importing ps files](https://jakubjares.com/2020/04/11/pester5-importing-ps-files/) article for detailed information.
2124
- Should `-Throw` is using `-like` to match the exception message instead of .Contains. Use `*` or any of the other `-like` wildcard to match only part of the message.
22-
- Variables defined during Discovery, are not available in Before*, After* and It. When generating tests via foreach blocks, make sure you pass all variables into the test using -TestCases / -ForEach.
23-
- Gherkin is removed, and will later move to it's own module, please keep using Pester version 4.
24-
- `TestDrive` is defined during Run only, it cannot be used in -TestCases / -ForEach.
25+
- Variables defined during Discovery, are not available in `BeforeAll/-Each`, `AfterAll/-Each` and `It`. When generating tests via foreach blocks, make sure you pass all variables into the test using `-ForEach`.
26+
- Gherkin is removed, please keep using Pester version 4.
27+
- `TestDrive` is defined during Run only, it cannot be used in `-ForEach`.
2528

2629
### Deprecated features
2730

28-
- `Assert-MockCalled` is deprecated, it is recommended to use [Should -Invoke](../usage/mocking)
29-
- `Assert-VerifiableMock` is deprecated, it is recommended to use [Should -InvokeVerifiable](../usage/mocking)
31+
- `Assert-MockCalled` is deprecated, it is recommended to use [Should -Invoke](../usage/mocking).
32+
- `Assert-VerifiableMock` is deprecated, it is recommended to use [Should -InvokeVerifiable](../usage/mocking).
33+
- Pending state (`Set-ItResult -Pending`) is deprecated and will be removed in a future version.
3034

3135
### Additional issues to be solved future releases
3236

3337
- `-Strict` switch is not available
34-
- Inconclusive and Pending states are currently no longer available, `-Pending` and `-Inconclusive` are translated to `-Skip` both on test blocks and when using `Set-ItResult`
35-
- Automatic Code coverage via -CI switch currently disabled as it's slow. Can still be enabled using configuration, but is largely untested.
36-
- Generating tests using foreach during discovery time works mostly, generating them from BeforeAll, to postpone expensive work till it is needed in case the test is filtered out also works, but is hacky. Get in touch if you need it and help me refine it.
37-
- Running on huge codebases is largely untested
38+
- Automatic Code coverage via -CI switch currently disabled as it's slow. Can still be enabled using configuraitonis largely untested.
39+
3840

3941
**Noticed more of them? Share please!**

versioned_docs/version-v5/migrations/v4-to-v5.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,18 @@ The following table shows a mapping of v4 Legacy parameters (those which have no
138138

139139
</div>
140140

141-
The following table shows the mapping for v4 *Show* property values to the configuration property *Output.Verbosity*:
141+
The following table shows the mapping for v4 `-Show` property values to the configuration property `Output.Verbosity`:
142142

143-
| *Show* value | Configuration Object *Output Verbosity* Property |
144-
| ------------ | ------------------------------------------------ |
145-
| All | Detailed |
146-
| Default | Detailed |
147-
| Detailed | Detailed |
148-
| Fails | Normal |
149-
| Diagnostic | Diagnostic |
150-
| Normal | Normal |
151-
| Minimal | Minimal |
152-
| None | None |
143+
| `-Show` Value | `Output.Verbosity` Property |
144+
| ------------- | ----------------------------|
145+
| All | Detailed |
146+
| Default | Detailed |
147+
| Detailed | Detailed |
148+
| Fails | Normal |
149+
| Diagnostic | Diagnostic |
150+
| Normal | Normal |
151+
| Minimal | Minimal |
152+
| None | None |
153153

154154

155155
### Implicit parameters for TestCases
@@ -170,7 +170,7 @@ This also works for Mock.
170170

171171
#### Mocks can be debugged
172172

173-
Mocks don't rewrite the scriptblock you provide anymore. You can now set breakpoints into them as well as any of the ParameterFilter or Should -Invoke Parameter filter.
173+
Mocks don't rewrite the scriptblock you provide anymore. You can now set breakpoints into them as well as any of the `-ParameterFilter` used in `Mock` and `Should -Invoke`.
174174

175175
#### Avoid putting in InModuleScope around your Describe and It blocks
176176

versioned_docs/version-v5/usage/output.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This option controls the general level of console output. Pester v5 supports the
3131

3232
### StackTraceVerbosity
3333

34-
**New in Pester 5.3!**
34+
**New in Pester 5.3.0!**<br/>
3535
When an error is shown due to a failed setup or test, a stacktrace is included to help you identify where the problem occured. Users might not care much about this while developers need it to identify and fix any issues.
3636
This option lets you control how much of the stacktrace that will be printed using one of the following levels:
3737

@@ -50,7 +50,7 @@ The result-object returned from `Run.PassThru / -PassThru` includes a `ErrorReco
5050

5151
### CIFormat
5252

53-
**New in Pester 5.3!**
53+
**New in Pester 5.3.0!**<br/>
5454
Pester supports CI-specific output syntaxes to highlight, log and navigate to errors in your tests for a few popular CI systems. This options lets your control how this behavior should work. The following levels are currently supported:
5555

5656
- **None**: Disable all CI-specific syntax. Error messages are presented in the format you're familiar with.
@@ -78,7 +78,7 @@ Auto-detection works by checking if `GITHUB_ACTIONS` environment variable is equ
7878

7979
### RenderMode
8080

81-
**New in Pester 5.4!**
81+
**New in Pester 5.4.0!**<br/>
8282
Pester supports multiple render modes for console output, including ANSI escape sequences which enables colors in CI-logs. The currently supported modes are:
8383

8484
- **Auto (default)**: Automatically enables the recommended mode using the following rules:

versioned_docs/version-v5/usage/skip.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,9 @@ Tests completed in 1.03s
5454
Tests Passed: 1, Failed: 0, Skipped: 4, Total: 5, NotRun: 0
5555
```
5656

57-
:::warning
58-
Pending is translated to skipped, Inconclusive does not exist anymore.
59-
:::
60-
6157
### Conditional skip
6258

63-
Evaluation of the skip-parameter is done as part of the Discovery-phase. This means you can also dynamically skip tests based on values available in that phase. Either as logic done in BeforeDiscovery or based on values passed into a parametrized test.
59+
Evaluation of the skip-parameter is done as part of the Discovery-phase. This means you can also dynamically skip tests based on values available in that phase. Either as logic done in `BeforeDiscovery` or based on values passed into a parametrized test.
6460

6561
```powershell
6662
$sb = {
@@ -126,3 +122,7 @@ Describing My Describe Block
126122
Tests completed in 206ms
127123
Tests Passed: 1, Failed: 0, Skipped: 2 NotRun: 0
128124
```
125+
126+
:::tip Skipping during Run-phase
127+
In certain scenarios you might need to mark a test as skipped or inconclusive during execution. This is possible using [`Set-ItResult`](../commands/Set-ItResult). Be aware that setup and teardown-blocks will be executed, so use `-Skip` whenever possible.
128+
:::

0 commit comments

Comments
 (0)