|
59 | 59 | Data = @{
|
60 | 60 | Path = $Path
|
61 | 61 | SettingsFilePath = $settingsFilePath
|
62 |
| - Verbose = $true |
| 62 | + Verbose = $env:GITHUB_ACTION_INPUT_VerbosePreference -eq 'Continue' |
| 63 | + Debug = $env:GITHUB_ACTION_INPUT_DebugPreference -eq 'Continue' |
63 | 64 | }
|
64 | 65 | }
|
65 | 66 | Write-Verbose 'ContainerParams:'
|
|
72 | 73 | Path = Join-Path -Path $PSScriptRoot -ChildPath '..\tests\PSModule\Common.Tests.ps1'
|
73 | 74 | Data = @{
|
74 | 75 | Path = $Path
|
75 |
| - Verbose = $true |
| 76 | + Verbose = $env:GITHUB_ACTION_INPUT_VerbosePreference -eq 'Continue' |
| 77 | + Debug = $env:GITHUB_ACTION_INPUT_DebugPreference -eq 'Continue' |
76 | 78 | }
|
77 | 79 | }
|
78 | 80 | Write-Verbose 'ContainerParams:'
|
|
86 | 88 | Path = Join-Path -Path $PSScriptRoot -ChildPath '..\tests\PSModule\Module.Tests.ps1'
|
87 | 89 | Data = @{
|
88 | 90 | Path = $Path
|
89 |
| - Verbose = $true |
| 91 | + Verbose = $env:GITHUB_ACTION_INPUT_VerbosePreference -eq 'Continue' |
| 92 | + Debug = $env:GITHUB_ACTION_INPUT_DebugPreference -eq 'Continue' |
90 | 93 | }
|
91 | 94 | }
|
92 | 95 | Write-Verbose 'ContainerParams:'
|
|
102 | 105 | Data = @{
|
103 | 106 | Path = $Path
|
104 | 107 | TestsPath = $moduleTestsPath
|
105 |
| - Verbose = $true |
| 108 | + Verbose = $env:GITHUB_ACTION_INPUT_VerbosePreference -eq 'Continue' |
| 109 | + Debug = $env:GITHUB_ACTION_INPUT_DebugPreference -eq 'Continue' |
106 | 110 | }
|
107 | 111 | }
|
108 | 112 | Write-Verbose 'ContainerParams:'
|
|
115 | 119 | if (Test-Path -Path $moduleTestsPath) {
|
116 | 120 | LogGroup "Add test - Module - $moduleName" {
|
117 | 121 | $containerParams = @{
|
118 |
| - Path = $moduleTestsPath |
| 122 | + Path = $moduleTestsPath |
| 123 | + Verbose = $env:GITHUB_ACTION_INPUT_VerbosePreference -eq 'Continue' |
| 124 | + Debug = $env:GITHUB_ACTION_INPUT_DebugPreference -eq 'Continue' |
119 | 125 | }
|
120 | 126 | Write-Verbose 'ContainerParams:'
|
121 | 127 | Write-Verbose "$($containerParams | ConvertTo-Json)"
|
|
134 | 140 |
|
135 | 141 | LogGroup "Importing module: $moduleName" {
|
136 | 142 | Add-PSModulePath -Path (Split-Path $Path -Parent)
|
137 |
| - Get-Module -Name $moduleName -ListAvailable | Remove-Module -Force |
| 143 | + $existingModule = Get-Module -Name $ModuleName -ListAvailable |
| 144 | + $existingModule | Remove-Module -Force -Verbose |
| 145 | + $existingModule.RequiredModules | ForEach-Object { $_ | Remove-Module -Force -Verbose -ErrorAction SilentlyContinue } |
| 146 | + $existingModule.NestedModules | ForEach-Object { $_ | Remove-Module -Force -Verbose -ErrorAction SilentlyContinue } |
138 | 147 | Import-Module -Name $moduleName -Force -RequiredVersion '999.0.0' -Global
|
139 | 148 | }
|
140 | 149 | }
|
|
147 | 156 | Container = $containers
|
148 | 157 | PassThru = $true
|
149 | 158 | }
|
| 159 | + Debug = @{ |
| 160 | + WriteDebugMessages = $env:GITHUB_ACTION_INPUT_DebugPreference = 'Continue' |
| 161 | + } |
150 | 162 | TestResult = @{
|
151 | 163 | Enabled = $testModule
|
152 | 164 | OutputFormat = 'NUnitXml'
|
|
173 | 185 |
|
174 | 186 | #region Run tests
|
175 | 187 | $verbosepref = $VerbosePreference
|
176 |
| - $VerbosePreference = 'SilentlyContinue' |
| 188 | + $debugpref = $DebugPreference |
| 189 | + $VerbosePreference = $env:GITHUB_ACTION_INPUT_VerbosePreference |
| 190 | + $DebugPreference = $env:GITHUB_ACTION_INPUT_DebugPreference |
177 | 191 | $results = Invoke-Pester @pesterParams
|
178 | 192 | $VerbosePreference = $verbosepref
|
| 193 | + $DebugPreference = $debugpref |
179 | 194 | #endregion
|
180 | 195 |
|
181 | 196 | $results
|
|
0 commit comments