Skip to content

Commit 6c6ff43

Browse files
committed
update appveyor Invoke-AppveyorTest to match how we run tests in build.psm1
1 parent e646c8f commit 6c6ff43

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tools/appveyor.psm1

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,21 @@ function Invoke-AppveyorTest {
5151
Write-Verbose -Verbose ("Running tests on PowerShell version " + $PSVersionTable.PSVersion)
5252
Write-Verbose -Verbose "Language set to '${env:LANG}'"
5353

54-
# Copy the generated modules into the out directory
55-
$modulePath = $env:PSModulePath.Split([System.IO.Path]::PathSeparator) | Where-Object { Test-Path $_} | Select-Object -First 1
56-
Copy-Item "${CheckoutPath}\out\PSScriptAnalyzer" "$modulePath\" -Recurse -Force
57-
Copy-Item "${CheckoutPath}\PSCompatibilityCollector\out\PSCompatibilityCollector" "$modulePath\" -Recurse -Force
54+
# set up env:PSModulePath to the build location, don't copy it to the "normal place"
55+
$analyzerVersion = ([xml](Get-Content "${CheckoutPath}\Engine\Engine.csproj")).SelectSingleNode(".//VersionPrefix")."#text".Trim()
56+
57+
if ( $analyzerVersion -lt 5 ) {
58+
$versionModuleDir = "${CheckoutPath}\out\PSScriptAnalyzer\${analyzerVersion}"
59+
Rename-Item "${versionModuleDir}" "${CheckoutPath}\out\PSScriptAnalyzer\PSScriptAnalyzer"
60+
$moduleDir = "${CheckoutPath}\out\PSScriptAnalyzer"
61+
}
62+
else{
63+
$moduleDir = "${CheckoutPath}\out"
64+
}
65+
66+
$env:PSModulePath = "${moduleDir}","${env:PSModulePath}" -join [System.IO.Path]::PathSeparator
67+
Write-Verbose -Verbose "module path: ${env:PSModulePath}"
68+
5869

5970
# Set up testing assets
6071
$testResultsPath = Join-Path ${CheckoutPath} TestResults.xml

0 commit comments

Comments
 (0)