Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Nov 5, 2023
1 parent 954e937 commit 30de16b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PSPublishModule.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$ModuleName = (Get-ChildItem $PSScriptRoot\*.psd1).BaseName
$ItemPath = [System.IO.Path]::Combine($PSScriptRoot, "*.psd1")
$ModuleName = (Get-ChildItem -Path $ItemPath).BaseName
$PrimaryModule = Get-ChildItem -Path $PSScriptRoot -Filter '*.psd1' -Recurse -ErrorAction SilentlyContinue -Depth 1
if (-not $PrimaryModule) {
throw "Path $PSScriptRoot doesn't contain PSD1 files. Failing tests."
Expand Down Expand Up @@ -41,7 +42,8 @@ foreach ($Module in $PSDInformation.RequiredModules) {
}
}
try {
Import-Module $PSScriptRoot\*.psd1 -Force -ErrorAction Stop
$Path = [System.IO.Path]::Combine($PSScriptRoot, "*.psd1")
Import-Module -Name $Path -Force -ErrorAction Stop
} catch {
Write-Color 'Failed to import module', $_.Exception.Message -Color Red
exit 1
Expand Down

0 comments on commit 30de16b

Please sign in to comment.