Pester offers multiple options to customize the console output to your preference. These settings are available in the Output-section of PesterConfiguration.
$conf = New-PesterConfiguration
Verbosity : The verbosity of output, options are None, Normal, Detailed and Diagnostic. (Normal, default: Normal)
StackTraceVerbosity : The verbosity of stacktrace output, options are None, FirstLine, Filtered and Full. (Filtered, default: Filtered)
CIFormat : The CI format of error output in build logs, options are None, Auto, AzureDevops and GithubActions. (Auto, default: Auto)
This page focuses on the general options available for all users. See VSCode for settings and features specific to using Pester with VSCode.
This option controls the general level of console output. Pester v5 supports the following levels:
- None: No console output is shown. Typically used in combination with
Run.PassThru / -PassThruto do custom post-processing of the results.
- Normal (default): Focus on successful containers and failed tests/blocks. Shows basic discovery information and the summary of all tests.
- Detailed: Similar to Normal, but this level shows all blocks and tests, including successful.
- Diagnostic: Very verbose, but useful when troubleshooting tests. This level beahves like Detailed, but also enables debug-messages. It enforces common debug message categories as a minimum, but additional levels can be enabled by appending to the list in
New in Pester 5.3! 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. This option lets you control how much of the stacktrace that will be printed using one of the following levels:
- None: No stacktrace is shown, only the error message.
- FirstLine: Only show the first line of the stacktrace. This is typically the line in your failing tests.
- Filtered (default): Shows stacktrace related to your code. Filters out lines related to Pester-runtime.
- Full: Shows unfiltered stacktrace including calls made by Pester-runtime. Mostly used for troubleshooting. This is equal to the option
Debug.ShowFullErrors = $trueused prior to Pester v5.3.
Error details are always available in the result-object
The result-object returned from
Run.PassThru / -PassThru includes a
ErrorRecord-property in all blocks/tests with full stacktrace and more, even if you've limited the console output using the options above.
New in Pester 5.3! 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:
- None: Disable all CI-specific syntax. Error messages are presented in the format you're familiar with.
- Auto (default): Automatically enables CI-specific format when Pester detects that it runs in a supported CI system. Will fallback to same output as None.
- AzureDevops: Enables Azure Devops-specific format to log errors and display the error messages in red.
- GithubActions: Enables Github Actions-specific format to log errors and display the error message in red. Error message and stacktrace are grouped.
In Azure Devops, the following features are enabled:
- Errors are logged and shown in the run summary. Clicking on a error will send you to the related lines in the build log.
- Error messages are highlighted with a prefix and colorized.
Auto-detection works by checking if
TF_BUILD environment variable is equal to
In Github Actions, the following features are enabled:
- Errors will be highlighted in the run summary.
- Error title will be highlighted in red. The remaining error message and stacktrace is placed in a expandable group to clean up the logs.
Auto-detection works by checking if
GITHUB_ACTIONS environment variable is equal to