maksit-webui/utils/modules/Engine/TestSupport.psm1
Maksym Sadovnychyy b74e9250a7
Some checks are pending
Storybook tests / storybook-tests (push) Waiting to run
(bugfix): HOSTNAMES_ARRAY_POLICY and deepDelta fixes
2026-07-06 21:34:08 +02:00

43 lines
1.1 KiB
PowerShell

#requires -Version 7.0
#requires -PSEdition Core
$modulesDir = Split-Path $PSScriptRoot -Parent
if (-not (Get-Command Write-Log -ErrorAction SilentlyContinue)) {
$loggingModulePath = Join-Path $modulesDir "Logging.psm1"
if (Test-Path $loggingModulePath -PathType Leaf) {
Import-Module $loggingModulePath -Force
}
}
function New-EngineContext {
param(
[Parameter(Mandatory = $true)]
[string]$ScriptDir,
[Parameter(Mandatory = $true)]
[string]$SrcDir,
[Parameter(Mandatory = $false)]
[psobject]$Settings,
[ValidateSet('single', 'ha')]
[string]$DeployMode = 'ha'
)
$badgesDir = $null
if ($Settings -and $Settings.PSObject.Properties['paths'] -and $Settings.paths.badgesDir) {
$badgesDir = [System.IO.Path]::GetFullPath((Join-Path $ScriptDir ([string]$Settings.paths.badgesDir)))
}
return [pscustomobject]@{
scriptDir = $ScriptDir
srcDir = $SrcDir
utilsDir = $SrcDir
badgesDir = $badgesDir
deployMode = $DeployMode
}
}
Export-ModuleMember -Function New-EngineContext