Skip to content

Commit

Permalink
Fix the test that fails in Travis CI build (PowerShell#1792)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxian-dbw authored and mirichmo committed Aug 13, 2016
1 parent 110c627 commit 9ab60d6
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ Describe 'use of a module from two runspaces' -Tags "CI" {
[string]$Content
)

Setup -Dir $Name
$manifestParams = @{
Path = "TestDrive:\$Name\$Name.psd1"
}
$TestModulePath = Join-Path -Path $TestDrive -ChildPath "TestModule"
$ModuleFolder = Join-Path -Path $TestModulePath -ChildPath $Name
New-Item -Path $ModuleFolder -ItemType Directory -Force > $null

if ($Content) {
Set-Content -Path "${TestDrive}\$Name\$Name.psm1" -Value $Content
$manifestParams['RootModule'] = "$Name.psm1"
Set-Content -Path "$ModuleFolder\$Name.psm1" -Value $Content

$manifestParams = @{
Path = "$ModuleFolder\$Name.psd1"
RootModule = "$Name.psm1"
}

New-ModuleManifest @manifestParams

$resolvedTestDrivePath = Split-Path ((get-childitem TestDrive:\)[0].FullName)
if (-not ($env:PSMODULEPATH -like "*$resolvedTestDrivePath*")) {
$env:PSMODULEPATH += "$([System.IO.Path]::PathSeparator)$resolvedTestDrivePath"
if ($env:PSMODULEPATH -notlike "*$TestModulePath*") {
$env:PSMODULEPATH += "$([System.IO.Path]::PathSeparator)$TestModulePath"
}
}

Expand Down

0 comments on commit 9ab60d6

Please sign in to comment.