Skip to main content
Version: v4

New-PesterOption

SYNOPSIS

Creates an object that contains advanced options for Invoke-Pester

SYNTAX

New-PesterOption [-IncludeVSCodeMarker] [[-TestSuiteName] <String>] [-Experimental] [-ShowScopeHints]
[[-ScriptBlockFilter] <Hashtable[]>] [<CommonParameters>]

DESCRIPTION

By using New-PesterOption you can set options what allow easier integration with external applications or modifies output generated by Invoke-Pester. The result of New-PesterOption need to be assigned to the parameter 'PesterOption' of the Invoke-Pester function.

EXAMPLES

EXAMPLE 1

$Options = New-PesterOption -TestSuiteName "Tests - Set A"

Invoke-Pester -PesterOption $Options -Outputfile ".\Results-Set-A.xml" -OutputFormat NUnitXML

The result of commands will be execution of tests and saving results of them in a NUnitMXL file where the root "test-suite" will be named "Tests - Set A".

PARAMETERS

-IncludeVSCodeMarker

When this switch is set, an extra line of output will be written to the console for test failures, making it easier for VSCode's parser to provide highlighting / tooltips on the line where the error occurred.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-TestSuiteName

When generating NUnit XML output, this controls the name assigned to the root "test-suite" element. Defaults to "Pester".

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: Pester
Accept pipeline input: False
Accept wildcard characters: False

-Experimental

Enables experimental features of Pester to be enabled.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ShowScopeHints

EXPERIMENTAL: Enables debugging output for debugging tranisition among scopes. (Experimental flag needs to be used to enable this.)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ScriptBlockFilter

Filters scriptblock based on the path and line number. This is intended for integration with external tools so we don't rely on names (strings) that can have expandable variables in them.

Type: Hashtable[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

You cannot pipe input to this command.

OUTPUTS

System.Management.Automation.PSObject

NOTES

https://pester.dev/docs/v4/commands/Invoke-Pester

EDIT THIS PAGE

This page was auto-generated using Pester's comment based help. To edit the content of this page, change the corresponding help in the pester/Pester v4 repository. See our contribution guide for more information.