@@ -308,7 +308,10 @@ function New-Catalog
308
308
function Test-ScriptAnalyzer
309
309
{
310
310
[CmdletBinding ()]
311
- param ( [switch ] $InProcess )
311
+ param (
312
+ [switch ] $InProcess ,
313
+ [string ] $WithPowerShell
314
+ )
312
315
313
316
END {
314
317
# versions 3 and 4 don't understand versioned module paths, so we need to rename the directory of the version to
@@ -347,10 +350,18 @@ function Test-ScriptAnalyzer
347
350
$analyzerPsd1Path = Join-Path - Path $script :destinationDir - ChildPath " $analyzerName .psd1"
348
351
$scriptBlock = [scriptblock ]::Create(" Import-Module '$analyzerPsd1Path '; Invoke-Pester -Path $testScripts -CI" )
349
352
if ( $InProcess ) {
353
+ Write-Verbose " Testing with PowerShell $ ( $PSVersionTable.PSVersion ) "
350
354
& $scriptBlock
351
355
}
356
+ elseif ( $WithPowerShell ) {
357
+ $pwshVersion = & ${WithPowerShell} -- version
358
+ Write-Verbose " Testing with $pwshVersion "
359
+ & ${WithPowerShell} - Command $scriptBlock
360
+ }
352
361
else {
353
362
$powershell = (Get-Process - id $PID ).MainModule.FileName
363
+ $pwshVersion = & ${powershell} -- version
364
+ Write-Verbose " Testing with $pwshVersion "
354
365
& ${powershell} - NoProfile - Command $scriptBlock
355
366
}
356
367
}
@@ -555,6 +566,13 @@ function Get-DotnetExe
555
566
$script :DotnetExe = $dotnetHuntPath
556
567
return $dotnetHuntPath
557
568
}
569
+
570
+ $dotnetHuntPath = " C:\Program Files\dotnet\dotnet.exe"
571
+ Write-Verbose - Verbose " checking Windows $dotnetHuntPath "
572
+ if ( test-path $dotnetHuntPath ) {
573
+ $script :DotnetExe = $dotnetHuntPath
574
+ return $dotnetHuntPath
575
+ }
558
576
}
559
577
else {
560
578
$dotnetHuntPath = " $HOME /.dotnet/dotnet"
0 commit comments