Initial import of HEROLL source and design documents
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
$projectRoot = $PSScriptRoot
|
||||
$nodeCommand = Get-Command node -ErrorAction SilentlyContinue
|
||||
$nodePath = if ($nodeCommand) {
|
||||
$nodeCommand.Source
|
||||
} else {
|
||||
Join-Path $env:USERPROFILE ".cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe"
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $nodePath)) { throw "Node.js was not found." }
|
||||
Set-Location -LiteralPath $projectRoot
|
||||
|
||||
& $nodePath "node_modules\typescript\bin\tsc" -p tsconfig.json
|
||||
if ($LASTEXITCODE -ne 0) { throw "TypeScript compilation failed." }
|
||||
& $nodePath "tests\core.test.mjs"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Core tests failed." }
|
||||
|
||||
$testUrl = "http://127.0.0.1:4173/mvp/"
|
||||
$server = $null
|
||||
$ownsServer = $false
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri $testUrl -UseBasicParsing -TimeoutSec 1
|
||||
$ready = $response.StatusCode -eq 200
|
||||
} catch {
|
||||
$ready = $false
|
||||
}
|
||||
|
||||
if (-not $ready) {
|
||||
$server = Start-Process -FilePath $nodePath -ArgumentList @("tools/server.mjs") -WorkingDirectory $projectRoot -WindowStyle Hidden -PassThru
|
||||
$ownsServer = $true
|
||||
}
|
||||
try {
|
||||
if (-not $ready) {
|
||||
for ($attempt = 0; $attempt -lt 30; $attempt += 1) {
|
||||
if ($server.HasExited) { throw "Test server failed to start." }
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri $testUrl -UseBasicParsing -TimeoutSec 1
|
||||
if ($response.StatusCode -eq 200) { $ready = $true; break }
|
||||
} catch {
|
||||
Start-Sleep -Milliseconds 100
|
||||
}
|
||||
}
|
||||
}
|
||||
if (-not $ready) { throw "Test server did not become ready." }
|
||||
& $nodePath "tests\browser-smoke.mjs"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Browser smoke test failed." }
|
||||
& $nodePath "tests\restoration.test.mjs"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Original-restoration comparison test failed." }
|
||||
Write-Host "All validation checks passed." -ForegroundColor Green
|
||||
} finally {
|
||||
if ($ownsServer -and -not $server.HasExited) { Stop-Process -Id $server.Id -Force }
|
||||
}
|
||||
Reference in New Issue
Block a user