API Reference
Get-ModuleTestFailures
Analyzes and summarizes failed Pester tests from either a Pester results object or an NUnit XML result file.
Remarks
This cmdlet is designed to make CI output and local troubleshooting easier by summarizing failures from: Use -OutputFormat to control whether the cmdlet writes a concise host summary, detailed messages, or emits JSON to the pipeline.
Examples
Analyze test failures from the default results location
PS>
Get-ModuleTestFailures
Searches for TestResults.xml under the project and prints a detailed failure report.
Analyze failures from a specific NUnit XML file
PS>
Get-ModuleTestFailures -Path 'Tests\TestResults.xml' -OutputFormat Summary
Writes a compact summary that is suitable for CI logs.
Pipe results from Invoke-ModuleTestSuite
PS>
Invoke-ModuleTestSuite -ProjectPath 'C:\Git\MyModule' | Get-ModuleTestFailures -OutputFormat Detailed -PassThru
Uses the in-memory results and returns the analysis object for further processing.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.
Syntax
Get-ModuleTestFailures [-OutputFormat <Summary|Detailed|Json>] [-PassThru] [-Path <String>] [-ProjectPath <String>] [-ShowSuccessful] [<CommonParameters>]
#
PathParameters
- OutputFormat ModuleTestFailureOutputFormat
- Format for displaying test failures.
- Possible values:
Summary,Detailed,Json - PassThru SwitchParameter
- Return the failure analysis object for further processing.
- Path String
- Path to the NUnit XML test results file. If not specified, searches for TestResults.xml under ProjectPath.
- ProjectPath String
- Path to the project directory used to locate test results when Path is not specified.
- ShowSuccessful SwitchParameter
- Include successful tests in the output (only applies to Summary format).
Outputs
System.Object
Get-ModuleTestFailures [-OutputFormat <Summary|Detailed|Json>] [-PassThru] [-ProjectPath <String>] [-ShowSuccessful] -TestResults <Object> [<CommonParameters>]
#
TestResultsParameters
- OutputFormat ModuleTestFailureOutputFormat
- Format for displaying test failures.
- Possible values:
Summary,Detailed,Json - PassThru SwitchParameter
- Return the failure analysis object for further processing.
- ProjectPath String
- Path to the project directory used to locate test results when Path is not specified.
- ShowSuccessful SwitchParameter
- Include successful tests in the output (only applies to Summary format).
- TestResults Object
- Pester test results object from Invoke-Pester, a ModuleTestSuiteResult from Invoke-ModuleTestSuite, or a precomputed ModuleTestFailureAnalysis.
Outputs
System.Object