Skip to content

Commit

Permalink
Merge pull request #145 from theohbrothers/test/entrypoint-improve-pr…
Browse files Browse the repository at this point in the history
…ocessing-of-variables-1

Test (entrypoint): Improve processing of variables
  • Loading branch information
joeltimothyoh authored Jul 20, 2024
2 parents 22f9903 + 22e5cb5 commit 36c59c8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ Set-StrictMode -Version Latest
$script:PesterDebugPreference_ShowFullErrors = $true

try {
# Process variables
$MODULE_NAME = (Get-Item $PSScriptRoot/../).Name
$MODULE_DIR = "$PSScriptRoot/../src/$MODULE_NAME" | Convert-Path -ErrorAction Stop
$MODULE_MANIFEST = Get-Item "$MODULE_DIR/$MODULE_NAME.psd1" -ErrorAction SilentlyContinue
$SCRIPT_MODULE = Get-Item "$MODULE_DIR/$MODULE_NAME.psm1" -ErrorAction SilentlyContinue
$MODULE_PATH = if ($MODULE_MANIFEST) { $MODULE_MANIFEST.FullName }
elseif ($SCRIPT_MODULE) { $SCRIPT_MODULE.FullName }
else { throw "Unable to locate module manifest file '$MODULE_DIR/$MODULE_NAME.psd1' nor script module file '$MODULE_DIR/$MODULE_NAME.psm1'." }

Push-Location $PSScriptRoot

# Process variables
$moduleManifest = Get-Item ../src/*/*.psd1 -ErrorAction SilentlyContinue
$scriptModule = Get-Item ../src/*/*.psm1 -ErrorAction SilentlyContinue
$moduleItem = if ($moduleManifest) { $moduleManifest }
elseif ($scriptModule) { $scriptModule }
else { throw "Unable to locate module manifest file (.psd1) nor script module file (.psm1)." }
$MODULE_PATH = $moduleItem.FullName
$MODULE_DIR = $moduleItem.Directory

# Install Pester if needed
"Checking Pester version" | Write-Host
$pesterMinimumVersion = [version]'4.0.0'
Expand Down

0 comments on commit 36c59c8

Please sign in to comment.