-
Notifications
You must be signed in to change notification settings - Fork 1
Usage
Import-Module -Name PSQualityCheck
Invoke-PSQualityCheck -File 'C:\Scripts\Script.ps1'
Invoke-PSQualityCheck -File @('C:\Scripts\Script.ps1', 'C:\Scripts\Script.ps1')
Invoke-PSQualityCheck -File 'C:\Scripts\Script.ps1' -ScriptAnalyzerRulesPath 'C:\ScriptAnalyzerRulesPath'
Invoke-PSQualityCheck -Path 'C:\Scripts'
Invoke-PSQualityCheck -Path 'C:\Scripts' -Recurse
Invoke-PSQualityCheck -Path @('C:\Scripts', 'C:\MoreScripts')
Invoke-PSQualityCheck -Path @('C:\Scripts', 'C:\MoreScripts') -Recurse
Invoke-PSQualityCheck -Path @('C:\Scripts', 'C:\MoreScripts') -Recurse -HelpRulesPath 'C:\HelpRules\HelpRules.psd1'
Tags are available For Module Tests and For Script Tests
Invoke-PSQualityCheck -Path 'C:\Scripts' -Recurse -Include "ValidSyntax"
To check the folder C:\Scripts and all subfolders beneath it and run the "ValidSyntax" and "NoScriptAnalyzerFailures" tests
Invoke-PSQualityCheck -Path 'C:\Scripts' -Recurse -Include "ValidSyntax", "NoScriptAnalyzerFailures"
To check the folder C:\Scripts and all subfolders beneath it and run all tests but exclude the "ValidSyntax" test
Invoke-PSQualityCheck -Path 'C:\Scripts' -Recurse -Exclude "ValidSyntax"
To check the folder C:\Scripts and all subfolders beneath it and run all tests but exclude the "ValidSyntax" and "NoScriptAnalyzerFailures" tests
Invoke-PSQualityCheck -Path 'C:\Scripts' -Recurse -Exclude "ValidSyntax", "NoScriptAnalyzerFailures"
To check the folder C:\Scripts and all subfolders beneath it and display a summary of the checks performed on screen
Invoke-PSQualityCheck -Path 'C:\Scripts' -Recurse -ShowCheckResults
output below uses sample data:
Test Files Tested Total Passed Failed Skipped
---- ------------ ----- ------ ------ -------
Module Tests 3 21 20 1 0
Extracting functions 3 3 3 0 0
Extracted function script tests 13 195 64 114 17
Script Tests 17 255 78 152 25
Total 33 474 165 267 42
$result = Invoke-PSQualityCheck -Path 'C:\Scripts' -Recurse -Passthru
The $result
variable is an object with one or more Pester Test Result Objects that are accessible via the object e.g. $result.Script
would return the script Pester Test Result Object
Invoke-PSQualityCheck -Path 'C:\Scripts' -Recurse -ExportCheckResults
this will place the test results (as XML files) in the current directory
Invoke-PSQualityCheck -ProjectPath 'C:\Scripts'
the -Passthru
, -ExportCheckResults
and -ShowCheckResults
are also available for use.