Commit 68a574e
## Summary
- Fixes #131 — when `DependencyType` is set globally via
`PSDependOptions`, advanced hashtable dependencies were incorrectly
parsed: the entire `@{Version=...; Parameters=...}` hashtable was
assigned to `Version` instead of being unpacked.
- Root cause: PowerShell evaluates `-and` before `-or`, so the three
`elseif` branches in `Parse-Dependency` had unintended grouping — `(-not
$DependencyType) OR ($DependencyType -eq 'X')` was effectively `(...
-and -not $DependencyType) OR ($DependencyType -eq 'X')`,
short-circuiting to `$true` for every dependency when a type was set
globally.
- Fix: add parentheses around the type sub-expression in all three
branches (PSGalleryModule, GitHub, Git).
## Test plan
- [x] Reproduce with the issue's example: `Get-Dependency -InputObject
$dep` where `PSDependOptions.DependencyType = 'PSGalleryModule'` and a
dependency uses hashtable syntax — `Version` should now be `'latest'`
(String), not `{Version, Parameters}` (Hashtable).
- [x] `Invoke-Pester .\Tests\` — 353 tests, 0 failures.
- [ ] Confirm simple-string syntax (`PsDepend = 'latest'`) still works
without `DependencyType` in `PSDependOptions`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 73b06ec commit 68a574e
1 file changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | | - | |
| 261 | + | |
| 262 | + | |
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
288 | | - | |
| 287 | + | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
312 | | - | |
| 311 | + | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| |||
0 commit comments