Skip to main content
Version: v6 (preview) 🚧

New-PesterConfiguration

This page was generated

Contributions are welcome in Pester-repo.

SYNOPSIS​

Creates a new PesterConfiguration object for advanced configuration of Invoke-Pester.

SYNTAX​

New-PesterConfiguration [[-Hashtable] <IDictionary>] [<CommonParameters>]

DESCRIPTION​

The New-PesterConfiguration function creates a new PesterConfiguration-object to enable advanced configurations for runnings tests using Invoke-Pester.

Without parameters, the function generates a configuration-object with default options. The returned PesterConfiguration-object can be modified to suit your requirements.

Calling New-PesterConfiguration is equivalent to calling [PesterConfiguration]::Default which was used in early versions of Pester 5.

For a complete list of options, see Get-Help about_PesterConfiguration or https://pester.dev/docs/usage/configuration

EXAMPLES​

EXAMPLE 1​

$config = New-PesterConfiguration
$config.Run.PassThru = $true

Invoke-Pester -Configuration $config

Creates a default PesterConfiguration-object and changes the Run.PassThru option to return the result object after the test run. The configuration object is provided to Invoke-Pester to alter the default behaviour.

EXAMPLE 2​

$MyOptions = @{
Run = @{ # Run configuration.
PassThru = $true # Return result object after finishing the test run.
}
Filter = @{ # Filter configuration
Tag = "Core","Integration" # Run only Describe/Context/It-blocks with 'Core' or 'Integration' tags
}
}

$config = New-PesterConfiguration -Hashtable $MyOptions

Invoke-Pester -Configuration $config

A hashtable is created with custom options and passed to the New-PesterConfiguration to merge with the default configuration. The options in the hashtable will override the default values. The configuration object is then provided to Invoke-Pester to begin the test run using the new configuration.

PARAMETERS​

-Hashtable​

Override the default values for the options defined in the provided dictionary/hashtable. See about_PesterConfiguration help topic or inspect a PesterConfiguration-object to learn about the schema and available options.

Type: IDictionary
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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​

OUTPUTS​

PesterConfiguration​

NOTES​

https://pester.dev/docs/commands/New-PesterConfiguration

https://pester.dev/docs/usage/Configuration

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

VERSION​

This page was generated using comment-based help in Pester 6.0.0-alpha5.