feat: establish legacy parity migration baseline
This commit is contained in:
45
scripts/Test-LegacyParityWeb.ps1
Normal file
45
scripts/Test-LegacyParityWeb.ps1
Normal file
@@ -0,0 +1,45 @@
|
||||
#Requires -Version 5.1
|
||||
|
||||
[CmdletBinding()]
|
||||
param([string] $NodePath)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($NodePath)) {
|
||||
$command = Get-Command node -CommandType Application -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1
|
||||
if ($null -ne $command) {
|
||||
$NodePath = $command.Source
|
||||
}
|
||||
else {
|
||||
$bundledNode = Join-Path $env:USERPROFILE `
|
||||
'.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe'
|
||||
if (Test-Path -LiteralPath $bundledNode -PathType Leaf) {
|
||||
$NodePath = $bundledNode
|
||||
}
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($NodePath)) {
|
||||
throw 'Node.js was not found. Pass an absolute executable path with -NodePath.'
|
||||
}
|
||||
}
|
||||
|
||||
if (-not [IO.Path]::IsPathRooted($NodePath) -or
|
||||
-not (Test-Path -LiteralPath $NodePath -PathType Leaf)) {
|
||||
throw 'NodePath must identify an existing absolute node executable.'
|
||||
}
|
||||
|
||||
$repositoryRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
||||
$appScript = Join-Path $repositoryRoot 'src\MBN_STOCK_WEBVIEW.LegacyParityApp\Web\app.js'
|
||||
$testFile = Join-Path $repositoryRoot 'tests\LegacyParityWeb\thin-client.test.cjs'
|
||||
|
||||
& $NodePath --check $appScript
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Legacy parity JavaScript syntax validation failed with exit code $LASTEXITCODE."
|
||||
}
|
||||
|
||||
& $NodePath --test $testFile
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Legacy parity Web tests failed with exit code $LASTEXITCODE."
|
||||
}
|
||||
Reference in New Issue
Block a user