test(packages): verify compact output and rule deduplication
This commit is contained in:
1 parent
2ce60a86ab
commit
67c28d4b08
2 files changed
+39
-7
No files matched your search
@@ -1,4 +1,6 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
[CmdletBinding()]
|
||||
param([switch]$Summary)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = Split-Path $PSScriptRoot -Parent
|
||||
$powerShellHook = Get-Content -LiteralPath (Join-Path $root 'shared/hooks/flashbang.ps1') -Raw
|
||||
$bashHook = Get-Content -LiteralPath (Join-Path $root 'shared/hooks/flashbang.sh') -Raw
|
||||
@@ -6,10 +8,11 @@ if ($powerShellHook -notmatch '\$HoldMs\s*=\s*250' -or $powerShellHook -notmatch
|
||||
$statusInput = '{"model":{"display_name":"Test Model"},"effort":{"level":"high"},"workspace":{"current_dir":"' + $root.Replace('\','\\') + '","repo":{"name":"TestRepo"}},"context_window":{"context_window_size":200000,"used_percentage":8.5,"total_input_tokens":15500,"total_output_tokens":1200}}'
|
||||
$branch = & git -C $root branch --show-current
|
||||
$buildSummaryOutput = & (Join-Path $root 'scripts/build.ps1') -Summary
|
||||
if (@($buildSummaryOutput | Where-Object { $_ -eq 'PASS build: codex-windows, claude-windows, codex-linux, claude-linux' }).Count -ne 1) { throw "build.ps1 -Summary must still print the PASS line: $($buildSummaryOutput -join '; ')" }
|
||||
if (@($buildSummaryOutput | Where-Object { $_ -eq 'Build: PASS | 4 packages' }).Count -ne 1) { throw "build.ps1 -Summary must still print the PASS line: $($buildSummaryOutput -join '; ')" }
|
||||
$statusOutput = ($statusInput | & (Join-Path $root 'shared/statusline/statusline.ps1')) -join "`n"
|
||||
$plainStatusOutput = [regex]::Replace($statusOutput, [char]27 + '\[[0-9;]*m', '')
|
||||
$expectedStatusOutput = "Test Model $([char]0x00B7) high`nTestRepo on $branch $([char]0x00B7) 9% ctx (16.7k tok)"
|
||||
if ($buildSummaryOutput.Count -ne 1) { throw 'Build summary must contain only one success line.' }
|
||||
if ($plainStatusOutput -ne $expectedStatusOutput) { throw 'PowerShell status line output is incorrect.' }
|
||||
$sourceAgentCount = @(Get-ChildItem (Join-Path $root 'shared/agents') -Directory).Count
|
||||
$sourceSkillCount = @(Get-ChildItem (Join-Path $root 'shared/skills') -Filter 'SKILL.md' -Recurse).Count
|
||||
@@ -42,6 +45,7 @@ foreach ($platform in @('windows','linux')) {
|
||||
$docContent = Get-Content -LiteralPath (Join-Path $package $docFile) -Raw
|
||||
if (([regex]::Matches($docContent, [regex]::Escape('Apply instructions in this order'))).Count -ne 1) { throw "$client-$platform must embed the priority rule exactly once" }
|
||||
if ($client -eq 'codex' -and $docContent -match 'Always load and apply `rules/general\.md`') { throw "$package must not still instruct loading general.md by path" }
|
||||
if ($client -eq 'claude' -and (Test-Path (Join-Path $package 'rules/general.md'))) { throw 'Claude must not automatically load a second copy of general rules.' }
|
||||
foreach ($splitRule in @('angular','wpf','ui-ux')) {
|
||||
$referencesDir = if ($client -eq 'codex') { Join-Path $package "rules/$splitRule/references" } else { Join-Path $package "skills/rules/rules-$splitRule/references" }
|
||||
if (-not (Test-Path $referencesDir) -or (Get-ChildItem $referencesDir -Filter '*.md').Count -eq 0) { throw "$package is missing reference files for $splitRule" }
|
||||
@@ -54,7 +58,7 @@ foreach ($platformSelection in @('1','2')) {
|
||||
$script:answers.Enqueue($platformSelection)
|
||||
$script:answers.Enqueue($clientSelection)
|
||||
function Read-Host { param($Prompt) $answers.Dequeue() }
|
||||
$output = & "$PSScriptRoot/install.ps1" -DryRun
|
||||
$output = & "$PSScriptRoot/install.ps1" -DryRun 6>$null
|
||||
if ($output -notcontains 'PASS install dry-run') { throw 'Dry-run did not finish.' }
|
||||
$platform = if ($platformSelection -eq '1') { 'windows' } else { 'linux' }
|
||||
if (($output -join "`n") -notmatch "-$platform") { throw 'Incorrect selected package.' }
|
||||
@@ -63,6 +67,12 @@ foreach ($platformSelection in @('1','2')) {
|
||||
$doctorSummaryOutput = & (Join-Path $root 'scripts/doctor.ps1') -Summary
|
||||
if (@($doctorSummaryOutput | Where-Object { $_ -match '^PASS ' }).Count -ne 0) { throw 'Doctor summary mode must not print individual PASS lines.' }
|
||||
if (@($doctorSummaryOutput | Where-Object { $_ -match '^Doctor: PASS \| \d+ checks$' }).Count -ne 1) { throw "Doctor summary mode must print one 'Doctor: PASS | N checks' line: $($doctorSummaryOutput -join '; ')" }
|
||||
Write-Output 'PASS four platform packages and six PowerShell selections'
|
||||
foreach ($entryPoint in @('install','update')) {
|
||||
$preview = @(& "$PSScriptRoot/$entryPoint.ps1" -Summary -DryRun -Client Both -Platform Windows)
|
||||
if ($preview -match '^(SOURCE|CREATE|UPDATE|UNCHANGED|BACKUP|DRYRUN|PASS) ') { throw "$entryPoint summary leaked per-item output." }
|
||||
if (@($preview | Where-Object { $_ -match ('^' + $entryPoint + ': PASS') }).Count -ne 1) { throw "$entryPoint summary is missing." }
|
||||
}
|
||||
$doctorSummaryOutput | Where-Object { $_ -match '^WARN ' }
|
||||
if ($Summary) { Write-Output 'Tests: PASS | platform packages' } else { Write-Output 'PASS four platform packages and six PowerShell selections' }
|
||||
exit 0
|
||||
|
||||
Reference in new issue
Block a user