Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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