-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests.ps1
More file actions
82 lines (67 loc) · 1.84 KB
/
run-tests.ps1
File metadata and controls
82 lines (67 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#Requires -Version 5.1
<#
.SYNOPSIS
Runs all tests for TFX and DASE and displays code coverage.
.DESCRIPTION
Executes the Vitest suite (TFX) and the Jest suite (DASE), shows a combined
coverage summary, and exits with a non-zero code if either suite fails.
#>
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$Root = $PSScriptRoot
$TfxDir = Join-Path $Root "TFX"
$DaseDir = Join-Path $Root "DASE"
$TfxFailed = $false
$DaseFailed = $false
$LASTEXITCODE = 0
function Write-Header([string]$Text)
{
$line = "-" * 72
Write-Host ""
Write-Host $line -ForegroundColor Cyan
Write-Host " $Text" -ForegroundColor Cyan
Write-Host $line -ForegroundColor Cyan
}
function Write-Result([string]$Suite, [bool]$Failed)
{
if ($Failed)
{ Write-Host " [FAIL] $Suite" -ForegroundColor Red }
else
{ Write-Host " [ OK ] $Suite" -ForegroundColor Green }
}
# --- TFX (Vitest) -------------------------------------------------------------
Write-Header "TFX -- Vitest + v8 coverage"
Push-Location $TfxDir
try
{
npx vitest run --coverage
if ($LASTEXITCODE -ne 0) { $TfxFailed = $true }
}
finally
{
Pop-Location
}
# --- DASE (Jest) --------------------------------------------------------------
Write-Header "DASE -- Jest + ts-jest coverage"
Push-Location $DaseDir
try
{
npx jest --coverage --forceExit
if ($LASTEXITCODE -ne 0) { $DaseFailed = $true }
}
finally
{
Pop-Location
}
# --- Summary ------------------------------------------------------------------
Write-Header "Results"
Write-Result "TFX (TFX/coverage/)" $TfxFailed
Write-Result "DASE (DASE/coverage/)" $DaseFailed
Write-Host ""
if ($TfxFailed -or $DaseFailed)
{
Write-Host "One or more suites FAILED." -ForegroundColor Red
exit 1
}
Write-Host "All suites passed." -ForegroundColor Green
exit 0