Skip to content

Commit 73810c5

Browse files
tablackburnclaude
andcommitted
fix(tests): correct $parameterNames variable and preserve original exception
- tests/Help.tests.ps1: rename undefined $parameterNames to $commandParameterNames in the help-vs-code parameter existence check. The variable was never assigned in scope, silently making the assertion always evaluate against $null. - {{ModuleName}}/{{ModuleName}}.psm1: re-throw original exception object in the dot-source catch block instead of throwing a new string, preserving stack traces and inner-exception details for debugging. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c1bab46 commit 73810c5

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

tests/Help.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Describe "Test help for <_.Name>" -ForEach $commands {
213213

214214
# Shouldn't find extra parameters in help
215215
It 'finds help parameter in code: <_>' {
216-
$_ -in $parameterNames | Should -Be $true
216+
$_ -in $commandParameterNames | Should -Be $true
217217
}
218218
}
219219
}

{{ModuleName}}/{{ModuleName}}.psm1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ foreach ($import in @($public + $private)) {
55
try {
66
. $import.FullName
77
} catch {
8-
throw "Unable to dot source [$($import.FullName)]"
8+
Write-Error "Unable to dot source '$($import.FullName)'"
9+
throw $_
910
}
1011
}
1112

0 commit comments

Comments
 (0)