### Test a PowerShell Module with New-PSModuleTest Source: https://github.com/psmodule/test-psmodule/blob/main/tests/outputTestRepo/outputs/docs/PSModuleTest/New-PSModuleTest.md This example demonstrates how to use the New-PSModuleTest cmdlet to perform tests on a specified module. It requires the module name as a string input. ```powershell Test-PSModule -Name 'World' ``` -------------------------------- ### GitHub Workflow for Testing Built Module with Test-PSModule Source: https://github.com/psmodule/test-psmodule/blob/main/README.md This YAML snippet shows a GitHub Actions workflow configured to use the Test-PSModule action for testing a PowerShell module after it has been built. It includes steps for checking out the code, initializing the environment, and running Test-PSModule with the 'Module' setting. ```yaml name: Test-PSModule on: [push] jobs: Test-PSModule: name: Test-PSModule runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 - name: Initialize environment uses: PSModule/Initialize-PSModule@main - name: Test-PSModule uses: PSModule/Test-PSModule@main with: Settings: Module ``` -------------------------------- ### GitHub Workflow for Testing Source Code with Test-PSModule Source: https://github.com/psmodule/test-psmodule/blob/main/README.md This YAML snippet demonstrates how to configure a GitHub Actions workflow to use the Test-PSModule action for testing the source code of a PowerShell module repository. It checks out the repository, initializes the PowerShell environment, and then runs Test-PSModule with the 'SourceCode' setting. ```yaml name: Test-PSModule on: [push] jobs: Test-PSModule: name: Test-PSModule runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 - name: Initialize environment uses: PSModule/Initialize-PSModule@main - name: Test-PSModule uses: PSModule/Test-PSModule@main with: Settings: SourceCode ``` -------------------------------- ### PowerShell Cmdlet Syntax for Get-PSModuleTest Source: https://github.com/psmodule/test-psmodule/blob/main/tests/outputTestRepo/outputs/docs/PSModuleTest/Get-PSModuleTest.md Defines the syntax for the Get-PSModuleTest cmdlet, specifying its required and optional parameters. This is crucial for understanding how to invoke the cmdlet correctly. ```powershell Get-PSModuleTest [-Name] [-ProgressAction ] [] ``` -------------------------------- ### Test PowerShell Module/Source Code Source: https://github.com/psmodule/test-psmodule/blob/main/README.md This endpoint allows you to run tests against a specified PowerShell module or source code. You can configure various aspects of the test execution, including the type of tests to run, debug and verbose output, versioning, and filtering. ```APIDOC ## POST /psmodule/test-psmodule ### Description Runs tests against a PowerShell module or source code. Supports various configuration options for test execution, filtering, and reporting. ### Method POST ### Endpoint /psmodule/test-psmodule ### Parameters #### Query Parameters - **Name** (string) - Optional - The name of the module to test. The name of the repository is used if not specified. - **Settings** (string) - Required - The type of tests to run. Can be either `Module` or `SourceCode`. - **Debug** (boolean) - Optional - Enable debug output. Defaults to 'false'. - **Verbose** (boolean) - Optional - Enable verbose output. Defaults to 'false'. - **Version** (string) - Optional - Specifies the version of the GitHub module to be installed. The value must be an exact version. - **Prerelease** (boolean) - Optional - Allow prerelease versions if available. Defaults to 'false'. - **WorkingDirectory** (string) - Optional - The working directory to use for the action. This is the root folder where tests and outputs are expected. Defaults to `'.'`. - **StepSummary_Mode** (string) - Optional - Controls which tests to show in the GitHub step summary. Allows "Full" (all tests), "Failed" (only failed tests), or "None" (disable step summary). Defaults to `Failed`. - **StepSummary_ShowTestOverview** (boolean) - Optional - Controls whether to show the test overview table in the GitHub step summary. Defaults to `false`. - **StepSummary_ShowConfiguration** (boolean) - Optional - Controls whether to show the configuration details in the GitHub step summary. Defaults to `false`. - **Run_ExcludePath** (string[]) - Optional - Directories/files to exclude from the run. - **Run_ScriptBlock** (string[]) - Optional - ScriptBlocks containing tests to be executed. - **Run_Container** (string[]) - Optional - ContainerInfo objects containing tests to be executed. - **Run_TestExtension** (string) - Optional - Filter used to identify test files (e.g. `.Tests.ps1`). - **Run_Exit** (boolean) - Optional - Whether to exit with a non-zero exit code on failure. - **Run_Throw** (boolean) - Optional - Whether to throw an exception on test failure. - **Run_SkipRun** (boolean) - Optional - Discovery only, skip actual test run. - **Run_SkipRemainingOnFailure** (string) - Optional - Skips remaining tests after the first failure. Options: `None`, `Run`, `Container`, `Block`. - **Filter_Tag** (string[]) - Optional - Tags of Describe/Context/It blocks to run. - **Filter_ExcludeTag** (string[]) - Optional - Tags of Describe/Context/It blocks to exclude. - **Filter_Line** (string) - Optional - Filter by file + scriptblock start line (e.g. `C:\tests\file1.Tests.ps1:37`). - **Filter_ExcludeLine** (string) - Optional - Exclude by file + scriptblock start line. Precedence over `Filter_Line`. - **Filter_FullName** (string) - Optional - Full name of a test with wildcards, joined by dot. E.g. `*.describe Get-Item.test1`. - **CodeCoverage_Enabled** (boolean) - Optional - Enable code coverage. - **CodeCoverage_OutputFormat** (string) - Optional - Format for the coverage report. Possible values: `JaCoCo`, `CoverageGutters`, `Cobertura`. - **CodeCoverage_OutputPath** (string) - Optional - Where to save the code coverage report (relative to the current dir). ### Request Example ```json { "Name": "MyModule", "Settings": "Module", "Debug": true, "Filter_Tag": ["integration"] } ``` ### Response #### Success Response (200) Details of the test run, including success status, test results, and coverage information if enabled. #### Response Example ```json { "Success": true, "TestsPassed": 15, "TestsFailed": 0, "CoverageEnabled": false } ``` ``` -------------------------------- ### Set-PSModuleTest Cmdlet Syntax Source: https://github.com/psmodule/test-psmodule/blob/main/tests/outputTestRepo/outputs/docs/PSModuleTest/Set-PSModuleTest.md Defines the command-line syntax for the Set-PSModuleTest cmdlet. It specifies the required '-Name' parameter and optional common parameters. ```powershell Set-PSModuleTest [-Name] [-ProgressAction ] [] ``` -------------------------------- ### Test-PSModuleTest Cmdlet Syntax Source: https://github.com/psmodule/test-psmodule/blob/main/tests/outputTestRepo/outputs/docs/PSModuleTest/Test-PSModuleTest.md Defines the syntax for the Test-PSModuleTest cmdlet. It specifies the required -Name parameter of type String and optional common parameters. ```powershell Test-PSModuleTest [-Name] [-ProgressAction ] [] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.