Skip to content

Commit

Permalink
Merge pull request #146 from theohbrothers/docs/samples-update-test-e…
Browse files Browse the repository at this point in the history
…ntrypoint-script-3

Docs (samples): Update test entrypoint script
  • Loading branch information
joeltimothyoh authored Jul 20, 2024
2 parents 36c59c8 + cf94fe7 commit 9e3e835
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/samples/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 9e3e835

Please sign in to comment.