-
Notifications
You must be signed in to change notification settings - Fork 1
Convert PesterSyntax
Converts the syntax of a file to the syntax of a newer Pester version.
Convert-PesterSyntax -Path <String[]> [-Pester6] [-UseNamedParameters] [-UsePositionalParameters] [-Force]
[-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
The Convert-PesterSyntax command is used to convert the syntax of a file to the syntax of a newer Pester version.. It supports converting to Pester 6 format.
Convert-PesterSyntax -Path "C:\Scripts\Test.ps1" -Pester6
Converts the syntax of the Test.ps1 file to Pester 6 syntax.
Get-ChildItem -Path "C:\Scripts" -Recurse -Filter "*.ps1" | Convert-PesterSyntax
Converts the syntax of all PowerShell files in the C:\Scripts directory and its subdirectories to the default (newest) Pester syntax.
Specifies that the file should be created without any confirmation.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Returns the script after converting the syntax. This parameter is most useful when passing in a single file to convert. If multiple files are passed in, the script of all the files will be returned as an array. If PassThru is specified, no file will not be modified.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the path of the file(s) to be converted. This parameter is mandatory and accepts a string or a FileInfo object.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Specifies that the syntax to convert to is Pester 6. This parameter is mandatory to convert to Pester 6 syntax.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies whether to use named parameters in the converted syntax.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies whether to use positional parameters in the converted syntax, where supported.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.