Skip to content

Commit 244ffdb

Browse files
committed
Import the module unambiguously
1 parent 0115c1f commit 244ffdb

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

PSModuleTemplate.Tests.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Pester tests, see https://github.com/Pester/Pester/wiki
22
Import-LocalizedData -BindingVariable manifest -BaseDirectory ./src/* -FileName (Split-Path $PWD -Leaf)
3-
# ensure the right cmdlets are tested
4-
$manifest.CmdletsToExport |Get-Command -CommandType Cmdlet -EA 0 |Remove-Item
5-
$module = Import-Module (Resolve-Path ./src/*/bin/Debug/*/*.psd1) -PassThru -vb
3+
$psd1 = Resolve-Path ./src/*/bin/Debug/*/*.psd1
4+
if(1 -lt ($psd1 |Measure-Object).Count) {throw "Too many module binaries found: $psd1"}
5+
$module = Import-Module "$psd1" -PassThru -vb
66
Describe $module.Name {
77
Context "$($module.Name) module" -Tag Module {
88
It "Given the module, the version should match the manifest version" {
@@ -32,3 +32,4 @@ Describe $module.Name {
3232
}
3333
}.GetNewClosure()
3434
$env:Path = $envPath
35+
`

0 commit comments

Comments
 (0)