Skip to content

Commit 2d4834e

Browse files
🩹 [Patch]: Update debug and verbose handling to use input parameters for better configurability
1 parent d9c8d5b commit 2d4834e

File tree

4 files changed

+10
-20
lines changed

4 files changed

+10
-20
lines changed

‎action.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ runs:
290290
LocalTestPath: ${{ steps.paths.outputs.LocalTestPath }}
291291
WorkingDirectory: ${{ inputs.WorkingDirectory }}
292292
with:
293-
Debug: 'true'
294-
Verbose: 'true'
293+
Debug: ${{ inputs.Debug }}
294+
Verbose: ${{ inputs.Verbose }}
295295
Version: ${{ inputs.Version }}
296296
Prerelease: ${{ inputs.Prerelease }}
297297
WorkingDirectory: ${{ inputs.WorkingDirectory }}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
@{
22
Path = Get-ChildItem -Path $PSScriptRoot -Filter *.Tests.ps1 | Select-Object -ExpandProperty FullName
33
Data = @{
4-
Path = $env:PSMODULE_INVOKE_PESTER_INPUT_Run_Path
5-
Debug = $true
6-
Verbose = $true
4+
Path = $env:PSMODULE_INVOKE_PESTER_INPUT_Run_Path
75
}
86
}

‎scripts/tests/Module/PSModule/PSModule.Tests.ps1‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
'PSReviewUnusedParameter', 'Path',
33
Justification = 'Path is used to specify the path to the module to test.'
44
)]
5+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
6+
'PSAvoidUsingWriteHost', '',
7+
Justification = 'Log outputs to GitHub Actions logs.'
8+
)]
59
[CmdLetBinding()]
610
Param(
711
[Parameter(Mandatory)]
@@ -17,17 +21,7 @@ BeforeAll {
1721
Describe 'PSModule - Module tests' {
1822
Context 'Module' {
1923
It 'The module should be importable' {
20-
{
21-
LogGroup 'Importing Module' {
22-
$currentDebugPreference = $DebugPreference
23-
$currentVerbosePreference = $VerbosePreference
24-
$DebugPreference = 'Continue'
25-
$VerbosePreference = 'Continue'
26-
Import-Module -Name $moduleName
27-
$DebugPreference = $currentDebugPreference
28-
$VerbosePreference = $currentVerbosePreference
29-
}
30-
} | Should -Not -Throw
24+
{ Import-Module -Name $moduleName } | Should -Not -Throw
3125
}
3226
}
3327

@@ -36,14 +30,14 @@ Describe 'PSModule - Module tests' {
3630
LogGroup 'Module manifest' {
3731
$result = Test-Path -Path $moduleManifestPath
3832
$result | Should -Be $true
39-
Write-Verbose $result
33+
Write-Host "$($result | Format-List | Out-String)"
4034
}
4135
}
4236
It 'Module Manifest is valid' {
4337
LogGroup 'Validating Module Manifest' {
4438
$result = Test-ModuleManifest -Path $moduleManifestPath
4539
$result | Should -Not -Be $null
46-
Write-Verbose $result
40+
Write-Host "$($result | Format-List | Out-String)"
4741
}
4842
}
4943
# It 'has a valid license URL' {}

‎scripts/tests/SourceCode/PSModule/PSModule.Container.ps1‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
Data = @{
44
Path = $env:PSMODULE_INVOKE_PESTER_INPUT_Run_Path
55
TestsPath = $env:LocalTestPath
6-
Debug = $false
7-
Verbose = $false
86
}
97
}

0 commit comments

Comments
 (0)