psmux 3.3.4

Terminal multiplexer for Windows - tmux alternative for PowerShell and Windows Terminal
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# Issue #36 - Comprehensive config command tests
# Tests all commands from the reported config file:
#   set -g mouse off, base-index, status-left, status-right, status-style,
#   cursor-style, cursor-blink, history-limit, prediction-dimming,
#   bind-key -T prefix h/v split-window
#
# https://github.com/psmux/psmux/issues/36

$ErrorActionPreference = "Continue"
$script:TestsPassed = 0
$script:TestsFailed = 0

function Write-Pass { param($msg) Write-Host "[PASS] $msg" -ForegroundColor Green; $script:TestsPassed++ }
function Write-Fail { param($msg) Write-Host "[FAIL] $msg" -ForegroundColor Red; $script:TestsFailed++ }
function Write-Info { param($msg) Write-Host "[INFO] $msg" -ForegroundColor Cyan }
function Write-Test { param($msg) Write-Host "[TEST] $msg" -ForegroundColor White }

# Wait for an option to match a pattern (polls show-options)
function Wait-ForOption {
    param($Session, $Binary, $Pattern, $TimeoutSec = 5)
    $deadline = (Get-Date).AddSeconds($TimeoutSec)
    while ((Get-Date) -lt $deadline) {
        $opts = & $Binary show-options -t $Session 2>&1
        if ($opts -match $Pattern) { return $true }
        Start-Sleep -Milliseconds 200
    }
    return $false
}

# Wait for a single-value option query (-v) to match exact value
function Wait-ForOptionValue {
    param($Session, $Binary, $Name, $Expected, $TimeoutSec = 5)
    $deadline = (Get-Date).AddSeconds($TimeoutSec)
    while ((Get-Date) -lt $deadline) {
        $val = (& $Binary show-options -v $Name -t $Session 2>&1) | Out-String
        # Only strip line endings, not trailing spaces which may be significant
        $val = $val -replace '[\r\n]+$', ''
        if ($val -eq $Expected) { return $true }
        Start-Sleep -Milliseconds 200
    }
    return $false
}

$PSMUX = "$PSScriptRoot\..\target\release\psmux.exe"
if (-not (Test-Path $PSMUX)) {
    $PSMUX = "$PSScriptRoot\..\target\debug\psmux.exe"
}
if (-not (Test-Path $PSMUX)) {
    Write-Host "[FATAL] psmux binary not found" -ForegroundColor Red
    exit 1
}

$SESSION_NAME = "issue36_test_$(Get-Random)"
Write-Info "Using psmux binary: $PSMUX"

# ─── Cleanup stale sessions ──────────────────────────────────
Write-Info "Cleaning up stale sessions..."
Start-Process -FilePath $PSMUX -ArgumentList "kill-server" -WindowStyle Hidden | Out-Null
Start-Sleep -Seconds 3
Remove-Item "$env:USERPROFILE\.psmux\*.port" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\.psmux\*.key"  -Force -ErrorAction SilentlyContinue

# ─── Start test session ──────────────────────────────────────
Write-Info "Starting test session: $SESSION_NAME"
Start-Process -FilePath $PSMUX -ArgumentList "new-session", "-d", "-s", $SESSION_NAME -WindowStyle Hidden | Out-Null
Start-Sleep -Seconds 3

$sessions = (& $PSMUX ls 2>&1) -join "`n"
if ($sessions -notmatch [regex]::Escape($SESSION_NAME)) {
    Write-Host "[FATAL] Could not start test session. Output: $sessions" -ForegroundColor Red
    exit 1
}
Write-Info "Session started successfully"
Write-Host ""

# ═══════════════════════════════════════════════════════════════
Write-Host "=" * 60
Write-Host "ISSUE #36 - CONFIG COMMAND TESTS"
Write-Host "=" * 60

# ─── 1. set -g mouse off ─────────────────────────────────────
Write-Host ""
Write-Host "--- mouse option ---"

Write-Test "Default mouse is on"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "mouse" -Expected "on") {
    Write-Pass "Default mouse is on"
} else {
    $v = (& $PSMUX show-options -v mouse -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected mouse=on, got: '$($v.Trim())'"
}

Write-Test "set -g mouse off"
& $PSMUX set-option -t $SESSION_NAME mouse off 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "mouse" -Expected "off") {
    Write-Pass "mouse set to off"
} else {
    $v = (& $PSMUX show-options -v mouse -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected mouse=off, got: '$($v.Trim())'"
}

Write-Test "show-options reflects mouse off"
if (Wait-ForOption -Session $SESSION_NAME -Binary $PSMUX -Pattern "mouse off") {
    Write-Pass "show-options shows mouse off"
} else {
    Write-Fail "show-options does not show mouse off"
}

Write-Test "set -g mouse on (restore)"
& $PSMUX set-option -t $SESSION_NAME mouse on 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "mouse" -Expected "on") {
    Write-Pass "mouse restored to on"
} else {
    Write-Fail "Failed to restore mouse to on"
}

# ─── 2. set -g base-index 1 ──────────────────────────────────
Write-Host ""
Write-Host "--- base-index option ---"

Write-Test "Default base-index is 0"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "base-index" -Expected "0") {
    Write-Pass "Default base-index is 0"
} else {
    $v = (& $PSMUX show-options -v base-index -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected base-index=0, got: '$($v.Trim())'"
}

Write-Test "set -g base-index 0"
& $PSMUX set-option -t $SESSION_NAME base-index 0 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "base-index" -Expected "0") {
    Write-Pass "base-index set to 0"
} else {
    Write-Fail "Failed to set base-index to 0"
}

Write-Test "set -g base-index 1 (restore)"
& $PSMUX set-option -t $SESSION_NAME base-index 1 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "base-index" -Expected "1") {
    Write-Pass "base-index restored to 1"
} else {
    Write-Fail "Failed to restore base-index to 1"
}

# ─── 3. set -g status-left ───────────────────────────────────
Write-Host ""
Write-Host "--- status-left option ---"

Write-Test "set -g status-left '[#S] '"
& $PSMUX set-option -t $SESSION_NAME status-left "[#S] " 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "status-left" -Expected "[#S] ") {
    Write-Pass "status-left set to '[#S] '"
} else {
    $v = (& $PSMUX show-options -v status-left -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected status-left='[#S] ', got: '$($v.Trim())'"
}

Write-Test "show-options reflects status-left"
$opts = (& $PSMUX show-options -t $SESSION_NAME 2>&1) -join "`n"
if ($opts -match 'status-left "\[#S\] "') {
    Write-Pass "show-options shows status-left"
} else {
    Write-Fail "show-options does not show status-left correctly: $opts"
}

# ─── 4. set -g status-right ──────────────────────────────────
Write-Host ""
Write-Host "--- status-right option ---"

Write-Test "set -g status-right '%H:%M %d-%b-%y'"
& $PSMUX set-option -t $SESSION_NAME status-right "%H:%M %d-%b-%y" 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "status-right" -Expected "%H:%M %d-%b-%y") {
    Write-Pass "status-right set to '%H:%M %d-%b-%y'"
} else {
    $v = (& $PSMUX show-options -v status-right -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected status-right='%H:%M %d-%b-%y', got: '$($v.Trim())'"
}

# ─── 5. set -g status-style ──────────────────────────────────
Write-Host ""
Write-Host "--- status-style option ---"

Write-Test "set -g status-style 'bg=green,fg=black'"
& $PSMUX set-option -t $SESSION_NAME status-style "bg=green,fg=black" 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "status-style" -Expected "bg=green,fg=black") {
    Write-Pass "status-style set correctly"
} else {
    $v = (& $PSMUX show-options -v status-style -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected status-style='bg=green,fg=black', got: '$($v.Trim())'"
}

Write-Test "set -g status-style with different colors"
& $PSMUX set-option -t $SESSION_NAME status-style "bg=blue,fg=white" 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "status-style" -Expected "bg=blue,fg=white") {
    Write-Pass "status-style changed to bg=blue,fg=white"
} else {
    $v = (& $PSMUX show-options -v status-style -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected status-style='bg=blue,fg=white', got: '$($v.Trim())'"
}

# ─── 6. set -g cursor-style ──────────────────────────────────
Write-Host ""
Write-Host "--- cursor-style option ---"

Write-Test "set -g cursor-style bar"
& $PSMUX set-option -t $SESSION_NAME cursor-style bar 2>&1
Start-Sleep -Milliseconds 500
$v = (& $PSMUX show-options -v cursor-style -t $SESSION_NAME 2>&1) | Out-String
$v = $v.Trim()
if ($v -eq "bar") {
    Write-Pass "cursor-style set to bar (visible via show-options -v)"
} else {
    Write-Fail "Expected cursor-style=bar, got: '$v'"
}

Write-Test "set -g cursor-style block"
& $PSMUX set-option -t $SESSION_NAME cursor-style block 2>&1
Start-Sleep -Milliseconds 500
$v = (& $PSMUX show-options -v cursor-style -t $SESSION_NAME 2>&1) | Out-String
$v = $v.Trim()
if ($v -eq "block") {
    Write-Pass "cursor-style set to block"
} else {
    Write-Fail "Expected cursor-style=block, got: '$v'"
}

Write-Test "set -g cursor-style underline"
& $PSMUX set-option -t $SESSION_NAME cursor-style underline 2>&1
Start-Sleep -Milliseconds 500
$v = (& $PSMUX show-options -v cursor-style -t $SESSION_NAME 2>&1) | Out-String
$v = $v.Trim()
if ($v -eq "underline") {
    Write-Pass "cursor-style set to underline"
} else {
    Write-Fail "Expected cursor-style=underline, got: '$v'"
}

Write-Test "cursor-style appears in show-options full dump"
$opts = (& $PSMUX show-options -t $SESSION_NAME 2>&1) -join "`n"
if ($opts -match "cursor-style") {
    Write-Pass "cursor-style visible in show-options"
} else {
    Write-Fail "cursor-style not visible in show-options"
}

# ─── 7. set -g cursor-blink ──────────────────────────────────
Write-Host ""
Write-Host "--- cursor-blink option ---"

Write-Test "set -g cursor-blink on"
& $PSMUX set-option -t $SESSION_NAME cursor-blink on 2>&1
Start-Sleep -Milliseconds 500
$v = (& $PSMUX show-options -v cursor-blink -t $SESSION_NAME 2>&1) | Out-String
$v = $v.Trim()
if ($v -eq "on") {
    Write-Pass "cursor-blink set to on"
} else {
    Write-Fail "Expected cursor-blink=on, got: '$v'"
}

Write-Test "set -g cursor-blink off"
& $PSMUX set-option -t $SESSION_NAME cursor-blink off 2>&1
Start-Sleep -Milliseconds 500
$v = (& $PSMUX show-options -v cursor-blink -t $SESSION_NAME 2>&1) | Out-String
$v = $v.Trim()
if ($v -eq "off") {
    Write-Pass "cursor-blink set to off"
} else {
    Write-Fail "Expected cursor-blink=off, got: '$v'"
}

Write-Test "cursor-blink appears in show-options full dump"
$opts = (& $PSMUX show-options -t $SESSION_NAME 2>&1) -join "`n"
if ($opts -match "cursor-blink") {
    Write-Pass "cursor-blink visible in show-options"
} else {
    Write-Fail "cursor-blink not visible in show-options"
}

# ─── 8. set -g history-limit ─────────────────────────────────
Write-Host ""
Write-Host "--- history-limit option ---"

Write-Test "Default history-limit is 2000"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "history-limit" -Expected "2000") {
    Write-Pass "Default history-limit is 2000"
} else {
    $v = (& $PSMUX show-options -v history-limit -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected history-limit=2000, got: '$($v.Trim())'"
}

Write-Test "set -g history-limit 9999"
& $PSMUX set-option -t $SESSION_NAME history-limit 9999 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "history-limit" -Expected "9999") {
    Write-Pass "history-limit set to 9999"
} else {
    $v = (& $PSMUX show-options -v history-limit -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected history-limit=9999, got: '$($v.Trim())'"
}

Write-Test "set -g history-limit 2000 (restore)"
& $PSMUX set-option -t $SESSION_NAME history-limit 2000 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "history-limit" -Expected "2000") {
    Write-Pass "history-limit restored to 2000"
} else {
    Write-Fail "Failed to restore history-limit to 2000"
}

# ─── 9. set -g prediction-dimming ────────────────────────────
Write-Host ""
Write-Host "--- prediction-dimming option ---"

Write-Test "set -g prediction-dimming off"
& $PSMUX set-option -t $SESSION_NAME prediction-dimming off 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "prediction-dimming" -Expected "off") {
    Write-Pass "prediction-dimming set to off"
} else {
    $v = (& $PSMUX show-options -v prediction-dimming -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected prediction-dimming=off, got: '$($v.Trim())'"
}

Write-Test "set -g prediction-dimming on"
& $PSMUX set-option -t $SESSION_NAME prediction-dimming on 2>&1
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "prediction-dimming" -Expected "on") {
    Write-Pass "prediction-dimming restored to on"
} else {
    Write-Fail "Failed to restore prediction-dimming to on"
}

# ─── 10. bind-key -T prefix h split-window -h ────────────────
Write-Host ""
Write-Host "--- bind-key tests ---"

Write-Test "bind-key -T prefix h split-window -h"
& $PSMUX bind-key -T prefix h split-window -h -t $SESSION_NAME 2>&1
Start-Sleep -Milliseconds 500
$keys = (& $PSMUX list-keys -t $SESSION_NAME 2>&1) -join "`n"
if ($keys -match "prefix.*h.*split.*-h") {
    Write-Pass "bind-key -T prefix h split-window -h registered"
} else {
    Write-Fail "bind-key -T prefix h not found in list-keys: $keys"
}

Write-Test "bind-key -T prefix v split-window -v"
& $PSMUX bind-key -T prefix v split-window -v -t $SESSION_NAME 2>&1
Start-Sleep -Milliseconds 500
$keys = (& $PSMUX list-keys -t $SESSION_NAME 2>&1) -join "`n"
if ($keys -match "prefix.*v.*split.*-v") {
    Write-Pass "bind-key -T prefix v split-window -v registered"
} else {
    Write-Fail "bind-key -T prefix v not found in list-keys: $keys"
}

# ─── 11. source-file test with full issue config ─────────────
Write-Host ""
Write-Host "--- source-file with full issue #36 config ---"

$CONFIG_FILE = "$PSScriptRoot\test_issue36.conf"
$configContent = @"
set -g mouse off
set -g base-index 1

# Customize status bar
set -g status-left "[#S] "
set -g status-right "%H:%M %d-%b-%y"
set -g status-style "bg=green,fg=black"

# Cursor style: block, underline, or bar
set -g cursor-style bar
set -g cursor-blink on

# Scrollback history
set -g history-limit 9999

# Prediction dimming (disable for apps like Neovim)
set -g prediction-dimming off

# Key bindings
bind-key -T prefix h split-window -h
bind-key -T prefix v split-window -v
"@

Set-Content -Path $CONFIG_FILE -Value $configContent -Encoding UTF8
Write-Test "source-file with full issue #36 config"
& $PSMUX source-file $CONFIG_FILE -t $SESSION_NAME 2>&1
Start-Sleep -Seconds 2

# Verify each option from the config file
Write-Test "Verify mouse off after source-file"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "mouse" -Expected "off") {
    Write-Pass "mouse=off after source-file"
} else {
    $v = (& $PSMUX show-options -v mouse -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected mouse=off after source-file, got: '$($v.Trim())'"
}

Write-Test "Verify base-index 1 after source-file"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "base-index" -Expected "1") {
    Write-Pass "base-index=1 after source-file"
} else {
    Write-Fail "base-index not 1 after source-file"
}

Write-Test "Verify status-left after source-file"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "status-left" -Expected "[#S] ") {
    Write-Pass "status-left='[#S] ' after source-file"
} else {
    $v = (& $PSMUX show-options -v status-left -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected status-left='[#S] ', got: '$($v.Trim())'"
}

Write-Test "Verify status-right after source-file"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "status-right" -Expected "%H:%M %d-%b-%y") {
    Write-Pass "status-right='%H:%M %d-%b-%y' after source-file"
} else {
    $v = (& $PSMUX show-options -v status-right -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected status-right='%H:%M %d-%b-%y', got: '$($v.Trim())'"
}

Write-Test "Verify status-style after source-file"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "status-style" -Expected "bg=green,fg=black") {
    Write-Pass "status-style='bg=green,fg=black' after source-file"
} else {
    $v = (& $PSMUX show-options -v status-style -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected status-style='bg=green,fg=black', got: '$($v.Trim())'"
}

Write-Test "Verify cursor-style after source-file"
$v = (& $PSMUX show-options -v cursor-style -t $SESSION_NAME 2>&1) | Out-String
$v = $v.Trim()
if ($v -eq "bar") {
    Write-Pass "cursor-style=bar after source-file"
} else {
    Write-Fail "Expected cursor-style=bar after source-file, got: '$v'"
}

Write-Test "Verify cursor-blink after source-file"
$v = (& $PSMUX show-options -v cursor-blink -t $SESSION_NAME 2>&1) | Out-String
$v = $v.Trim()
if ($v -eq "on") {
    Write-Pass "cursor-blink=on after source-file"
} else {
    Write-Fail "Expected cursor-blink=on after source-file, got: '$v'"
}

Write-Test "Verify history-limit after source-file"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "history-limit" -Expected "9999") {
    Write-Pass "history-limit=9999 after source-file"
} else {
    $v = (& $PSMUX show-options -v history-limit -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected history-limit=9999, got: '$($v.Trim())'"
}

Write-Test "Verify prediction-dimming after source-file"
if (Wait-ForOptionValue -Session $SESSION_NAME -Binary $PSMUX -Name "prediction-dimming" -Expected "off") {
    Write-Pass "prediction-dimming=off after source-file"
} else {
    $v = (& $PSMUX show-options -v prediction-dimming -t $SESSION_NAME 2>&1) | Out-String
    Write-Fail "Expected prediction-dimming=off, got: '$($v.Trim())'"
}

Write-Test "Verify bind h split-window -h after source-file"
$keys = (& $PSMUX list-keys -t $SESSION_NAME 2>&1) -join "`n"
if ($keys -match "prefix.*h.*split.*-h") {
    Write-Pass "bind h split-window -h present after source-file"
} else {
    Write-Fail "bind h split-window -h NOT found after source-file"
}

Write-Test "Verify bind v split-window -v after source-file"
if ($keys -match "prefix.*v.*split.*-v") {
    Write-Pass "bind v split-window -v present after source-file"
} else {
    Write-Fail "bind v split-window -v NOT found after source-file"
}

# ─── Cleanup ──────────────────────────────────────────────────
Write-Host ""
Write-Info "Cleaning up..."

# Kill session
& $PSMUX kill-session -t $SESSION_NAME 2>&1
Start-Sleep -Seconds 1

# Remove test config file
if (Test-Path $CONFIG_FILE) {
    Remove-Item $CONFIG_FILE -Force
    Write-Info "Removed test config file"
}

Write-Host ""
Write-Host "=" * 60
Write-Host "ISSUE #36 TEST SUMMARY"
Write-Host "=" * 60
Write-Host "Passed: $script:TestsPassed" -ForegroundColor Green
Write-Host "Failed: $script:TestsFailed" -ForegroundColor Red
Write-Host ""

if ($script:TestsFailed -gt 0) {
    Write-Host "SOME TESTS FAILED" -ForegroundColor Red
    exit 1
} else {
    Write-Host "ALL TESTS PASSED" -ForegroundColor Green
    exit 0
}