Test-GitLabModule
SYNOPSIS
Test a GitLab PowerShell module using Pester and PSScriptAnalyzer.
SYNTAX
All (Default)
Test-GitLabModule [-BranchName <String[]>] [-ExcludedTags <String[]>] [-ExcludedRules <String[]>]
[-IncludedFiles <String[]>] [-ExcludedFiles <String[]>] [-All] [<CommonParameters>]
Pester
Test-GitLabModule [-BranchName <String[]>] [-Pester] [-ExcludedTags <String[]>] [<CommonParameters>]
PSSA
Test-GitLabModule [-BranchName <String[]>] [-Analyzer] [-ExcludedRules <String[]>] [-IncludedFiles <String[]>]
[-ExcludedFiles <String[]>] [<CommonParameters>]
DESCRIPTION
This function validates a GitLab PowerShell module by running Pester tests and analyzing the code with PSScriptAnalyzer. It supports filtering branches, excluding specific tags or rules, and analyzing specific files. The function can be run in different modes: Pester, PSScriptAnalyzer, or both.
EXAMPLES
EXAMPLE 1
Runs Pester tests on the module, excluding tests with the "Integration" tag.
EXAMPLE 2
Runs PSScriptAnalyzer on the module, excluding the "PSUseCorrectCasing" rule.
EXAMPLE 3
Runs both Pester tests and PSScriptAnalyzer analysis on the module.
EXAMPLE 4
Runs Pester tests on the module for the "develop" branch.
PARAMETERS
-BranchName
The branch name(s) for which the tests should be executed. Default is `@('master', 'main')`.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: @('master', 'main')
Accept pipeline input: False
Accept wildcard characters: False
-Pester
A switch to run Pester tests on the module.
Type: SwitchParameter
Parameter Sets: Pester
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ExcludedTags
A list of tags to exclude from Pester tests.
Type: String[]
Parameter Sets: All, Pester
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Analyzer
A switch to run PSScriptAnalyzer on the module.
Type: SwitchParameter
Parameter Sets: PSSA
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ExcludedRules
A list of rules to exclude from PSScriptAnalyzer analysis.
Type: String[]
Parameter Sets: All, PSSA
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludedFiles
A list of files to include in PSScriptAnalyzer analysis.
Type: String[]
Parameter Sets: All, PSSA
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ExcludedFiles
A list of files to exclude from PSScriptAnalyzer analysis.
Type: String[]
Parameter Sets: All, PSSA
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-All
A switch to run both Pester tests and PSScriptAnalyzer analysis.
Type: SwitchParameter
Parameter Sets: All
Aliases:
Required: False
Position: Named
Default value: False
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.