ticketmaster / poshspec

Infrastructure Testing DSL running in Pester
MIT License
183 stars 32 forks source link

Path prompt with SoftwareProduct #55

Closed glaisne closed 5 years ago

glaisne commented 7 years ago

I get a 'Path[0]:' prompt when using SoftwareProduct for Test-Path. Somehow the $_ in the Test-Path scriptblock is getting lost somewhere in lines 81-82 on get-PoshspecParam.ps1.

  $expressionString = $ExecutionContext.InvokeCommand.ExpandString($expressionString)
  Write-Output -InputObject ([PSCustomObject]@{Name = $nameString; Expression = $expressionString})

I'm getting this error on the same system running PS 5.1 in vscode and the regular host.

image image

jgigler commented 7 years ago

@glaisne what version of poshspec are you using?

cdhunt commented 7 years ago

I did not do a very good code review on this function. It has a number of issues and the whole thing should be redesigned. If anyone would like to take a stab at it, that would be great. Otherwise, I'll try to get to it shortly.

Issues:

glaisne commented 7 years ago

I'm using 2.2.1. Accrding to repositorySourceLocation, I pulled it from powershellGallery.com. My PS version is 5.1.15063.296, CLR is 4.0.30319.42000.

wikijm commented 5 years ago

Hi,

I encounter the same issue with:

PSVersion 5.1.17134.407
PSEdition Desktop
BuildVersion 10.0.17134.407
CLRVersion 4.0.30319.42000

Script poshspec Version 2.2.2

Glober777 commented 5 years ago

@cdhunt, given that -Exists feels more natural (even though it is specific to paths), I wonder if it would make sense to dynamically swap -Exists with -Not -NullOrEmpty within SoftwareProduct before calling Get-PoshspecParam. What do you think?

Glober777 commented 5 years ago

@cdhunt, @markwragg is there a chance that you could publish a new version with this fix to the PSGallery?

markwragg commented 5 years ago

I can't currently publish new versions but Chris is going to give me access to do so will do after that.

markwragg commented 5 years ago

Fixed as of version 2.2.8 which has just been published to the gallery.

Glober777 commented 5 years ago

Yay!!! Thanks a ton, @markwragg