Skip to content

Commit 93dd7d5

Browse files
🩹 [Patch]: Refactor debug and verbose handling in action.yml and PSModule.Tests.ps1 for improved logging control
1 parent b2e9014 commit 93dd7d5

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

‎action.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ runs:
290290
LocalTestPath: ${{ steps.paths.outputs.LocalTestPath }}
291291
WorkingDirectory: ${{ inputs.WorkingDirectory }}
292292
with:
293-
Debug: 'true'
294-
Verbose: 'true'
295-
Prerelease: ${{ inputs.Prerelease }}
293+
Debug: ${{ inputs.Debug }}
294+
Verbose: ${{ inputs.Verbose }}
296295
Version: ${{ inputs.Version }}
296+
Prerelease: ${{ inputs.Prerelease }}
297297
WorkingDirectory: ${{ inputs.WorkingDirectory }}
298298
Path: ${{ steps.paths.outputs.TestPath }}
299299
StepSummary_Mode: ${{ inputs.StepSummary_Mode }}

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ Describe 'PSModule - Module tests' {
1919
It 'The module should be importable' {
2020
{
2121
LogGroup 'Importing Module' {
22-
Import-Module -Name $moduleName -Force
22+
#Get current debug preference and verbose preference
23+
$currentDebugPreference = $DebugPreference
24+
$currentVerbosePreference = $VerbosePreference
25+
$DebugPreference = 'Continue'
26+
$VerbosePreference = 'Continue'
27+
Import-Module -Name $moduleName -Force -Verbose -Debug
28+
#Set debug preference back to original value
29+
$DebugPreference = $currentDebugPreference
30+
$VerbosePreference = $currentVerbosePreference
2331
}
2432
} | Should -Not -Throw
2533
}

0 commit comments

Comments
 (0)