Skip to content
Merged
Show file tree
Hide file tree
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 @@ -317,12 +317,12 @@ internal bool LoadUsingModulePath(PSModuleInfo parentModule, bool found, IEnumer

module = LoadUsingExtensions(parentModule, name, qualifiedPath, extension, null, this.BasePrefix, ss, options, manifestProcessingFlags, out found);
}
if (found)
{
break;
}
#if UNIX
}
if (found)
{
break;
}
}
if (found)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
Describe "Import-Module" -Tags "CI" {
$moduleName = "Microsoft.PowerShell.Security"
BeforeAll {
$originalPSModulePath = $env:PSModulePath
New-Item -ItemType Directory -Path "$testdrive\Modules\TestModule\1.1" -Force > $null
New-Item -ItemType Directory -Path "$testdrive\Modules\TestModule\2.0" -Force > $null
$env:PSModulePath += [System.IO.Path]::PathSeparator + "$testdrive\Modules"
New-ModuleManifest -Path "$testdrive\Modules\TestModule\1.1\TestModule.psd1" -ModuleVersion 1.1
New-ModuleManifest -Path "$testdrive\Modules\TestModule\2.0\TestModule.psd1" -ModuleVersion 2.0
}

AfterAll {
$env:PSModulePath = $originalPSModulePath
}

BeforeEach {
Remove-Module -Name $moduleName -Force
Expand All @@ -24,9 +36,14 @@

It "should be able to load an already loaded module" {
Import-Module $moduleName
{ $script:module = Import-Module $moduleName -PassThru } | Should Not Throw
{ $script:module = Import-Module $moduleName -PassThru -ErrorAction Stop } | Should Not Throw
Get-Module -Name $moduleName | Should Be $script:module
}

It "should only load the specified version" {
Import-Module TestModule -RequiredVersion 1.1
(Get-Module TestModule).Version | Should Be "1.1"
}
}

Describe "Import-Module with ScriptsToProcess" -Tags "CI" {
Expand Down