From c9fbaf55bb6b4779a98cb91453bd7ceb3be38322 Mon Sep 17 00:00:00 2001 From: Raimund Andree Date: Sun, 4 Oct 2026 11:46:45 +0200 Subject: [PATCH] ci: report each Pester test once on AppVeyor AppVeyor build 54834154 passed all 218 Pester tests but listed 870 on its Tests tab: the NUnit import files a Pester 5 test under every block that contains it (Pester, test file, Describe, and Context). Report the results through the build worker API instead (POST api/tests/batch): one entry per test with its outcome, duration, and error message. Outside AppVeyor, and when no test ran, the step sends nothing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant --- .memory-bank/activeContext.md | 45 +++++++++++++++++----------------- .memory-bank/progress.md | 15 ++++++++---- .memory-bank/systemPatterns.md | 3 +++ .memory-bank/techContext.md | 7 +++++- appveyor.yml | 22 ++++++++++++----- 5 files changed, 58 insertions(+), 34 deletions(-) diff --git a/.memory-bank/activeContext.md b/.memory-bank/activeContext.md index 090eb8a..760b817 100644 --- a/.memory-bank/activeContext.md +++ b/.memory-bank/activeContext.md @@ -9,31 +9,32 @@ source: current task evidence ## Current focus -Work package 2 (ship the generated help) on branch `ai/ship-help`, stacked -on `ai/housekeeping`; the work packages and their order are in -`progress.md`. +Work packages 1 and 2 are pushed; the maintainer opens their PRs: +`ai/housekeeping` into `master`, and `ai/ship-help` into +`ai/housekeeping`. The work packages and their order are in `progress.md`. ## Evidence -- `Get-Help` showed only the syntax: the module shipped a pre-4.x MAML file - named `NTFSSecurity-Help.xml`; PowerShell looks for - `en-US\NTFSSecurity.dll-Help.xml` (`(Get-Command).HelpFile`). -- `New-ExternalHelp` output is byte-identical between runs (756,107 bytes, - 36 commands, UTF-8 with BOM, CRLF). -- `Tests\Help.Tests.ps1`: 218 of 218 pass in Windows PowerShell 5.1; 182 - pass and 36 skip in PowerShell 7.6.1. Without `bin\Release\en-US`, 180 of - 182 failed; against the baseline build, 144 of 146 failed; with the old - help file, the link-spacing test failed for exactly the five reworded - pages. -- PowerShell 7 resolves the same online URI (`GetUriForOnlineHelp` through - the help system), but its `BypassOnlineHelpRetrieval` hook skips help - files, so the `-Online` test is Windows PowerShell only. -- A parallel session committed `74abb0b` (PR #83 note) on `ai/ship-help` - 33 seconds after the branch was created and reset `ai/housekeeping` to - it; `origin/ai/ship-help` exists at `74abb0b`. +- AppVeyor 54834155 (`ai/housekeeping`, `74abb0b`) passed. AppVeyor + 54834154 (`ai/ship-help`, `fba3a7d`) passed all four `test_script` + steps; Pester passed 218 of 218 tests in Windows PowerShell 5.1, + including the `Get-Help -Online` tests. +- The same build listed 870 tests on the Tests tab: the NUnit import files + each Pester 5 test under every enclosing block (Pester, file, Describe, + Context), so 216 tests appear four times and 2 three times. The + follow-up commit on `ai/ship-help` reports the results through the build + worker API instead (`POST api/tests/batch`), one entry per test; a local + run of step 04 against a sample test file sent 11 entries for 11 tests. +- The AppVeyor job log API returns `application/octet-stream`; decode the + bytes as UTF-8 before searching it. +- Merging work package 1 with a merge commit keeps `ai/ship-help` valid; + after a squash merge it needs + `git rebase --onto origin/master ai/housekeeping ai/ship-help`. +- PR descriptions for both work packages are in the session folder + (`files/pr`), outside the repository. ## Next step -The maintainer pushes `ai/housekeeping` (`74abb0b`) and `ai/ship-help`, -opens the PR (base `ai/housekeeping` until WP1 merges), and confirms a -green AppVeyor run; then work package 3 (Read the Docs). +The maintainer pushes the follow-up commit on `ai/ship-help`, opens both +PRs, and checks that AppVeyor lists 218 tests; then work package 3 (Read +the Docs). diff --git a/.memory-bank/progress.md b/.memory-bank/progress.md index c819570..53dcd2d 100644 --- a/.memory-bank/progress.md +++ b/.memory-bank/progress.md @@ -33,7 +33,7 @@ source is unchanged since the 4.2.6 release except the superseded: #91 ships the same two `learn.microsoft.com` links in `Docs/index.md` and `README.md`. The maintainer decided to close it; the remote-mutation hook denied the agent's `gh pr close`, so the - maintainer closes it by hand. + maintainer closed it by hand (2026-10-02 21:18 UTC). - 2026-10-02: Work package 2 (ship help, `ai/ship-help`, stacked on `ai/housekeeping`): `en-US\NTFSSecurity.dll-Help.xml` generated from `Docs/Cmdlets`, committed, copied by the csproj, and listed in a complete @@ -43,6 +43,10 @@ source is unchanged since the 4.2.6 release except the because platyPS drops the space after a link in the help text. Tests: 218 of 218 pass in Windows PowerShell 5.1; without the help file 180 of 182 failed. +- 2026-10-04: Work packages 1 and 2 pushed; AppVeyor 54834155 + (`74abb0b`) and 54834154 (`fba3a7d`, 218 of 218 Pester tests) passed. A + follow-up commit reports each test once on the AppVeyor Tests tab + (the NUnit upload listed 870 entries). ## Stable capabilities @@ -58,10 +62,11 @@ Work packages in the order agreed with the maintainer. Each gets one `ai/` branch and PR, committed locally; the maintainer pushes, and the next package starts only after the maintainer's go-ahead. -1. Housekeeping: `ai/housekeeping` pushed at `f409608`; the PR #83 note - (`74abb0b`, committed by a parallel session) is local only. -2. Ship help: committed on `ai/ship-help` (Decision 8); awaiting push, PR, - and a green AppVeyor run. +1. Housekeeping: `ai/housekeeping` pushed at `74abb0b`, AppVeyor green; + PR into `master` to open. +2. Ship help: `ai/ship-help` pushed at `fba3a7d`, AppVeyor green; the + follow-up commit for the Tests tab awaits push. PR into + `ai/housekeeping` to open. 3. Read the Docs: project `ntfssecurity` (maintainer `Sup3rlativ3`) builds the fork; switch it to this repository or import a new project. Ask before installing Python for `mkdocs build --strict`. diff --git a/.memory-bank/systemPatterns.md b/.memory-bank/systemPatterns.md index 91abfd3..e377dbd 100644 --- a/.memory-bank/systemPatterns.md +++ b/.memory-bank/systemPatterns.md @@ -78,3 +78,6 @@ Each Decision record is a file in `decisions/`; read only the relevant ones. `BypassOnlineHelpRetrieval`, which returns the URI instead of opening a browser. In PowerShell 7 the hook also skips the help file, so that test runs only in Windows PowerShell; PowerShell 7 resolves the same URI. +- Report Pester 5 results to AppVeyor through the build worker API, not as + an uploaded NUnit file: the NUnit import files each test under every + enclosing block (870 entries for 218 tests in build 54834154). diff --git a/.memory-bank/techContext.md b/.memory-bank/techContext.md index edd4435..8acbb66 100644 --- a/.memory-bank/techContext.md +++ b/.memory-bank/techContext.md @@ -81,7 +81,12 @@ source: repository evidence `Update-MarkdownHelp` and fail on `git diff -- Docs/Cmdlets`; 02 `Get-MarkdownLink -BrokenOnly`; 03 regenerate the help file and fail on `git status --porcelain -- NTFSSecurity/en-US`; 04 Pester 5.7.1 on - `Tests` with results uploaded to AppVeyor. + `Tests`, each result reported once through the build worker API + (`POST $env:APPVEYOR_API_URL/api/tests/batch`). +- AppVeyor REST API (public, no token): build + `api/projects/raandree/ntfssecurity/builds/`, job log + `api/buildjobs//log` (bytes; decode as UTF-8), and test list + `api/buildjobs//tests`. - Run platyPS in Windows PowerShell 5.1 to avoid PowerShell 7.4+ `-ProgressAction` noise. - Placeholder check: no `{{` left in `Docs/Cmdlets/*.md`. diff --git a/appveyor.yml b/appveyor.yml index af435b0..9354623 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -63,13 +63,23 @@ test_script: $configuration.Run.Path = '.\Tests' $configuration.Run.PassThru = $true $configuration.Output.Verbosity = 'Detailed' - $configuration.TestResult.Enabled = $true - $configuration.TestResult.OutputFormat = 'NUnitXml' - $configuration.TestResult.OutputPath = "$env:TEMP\PesterResults.xml" $result = Invoke-Pester -Configuration $configuration - if ($env:APPVEYOR_JOB_ID) { - $webClient = New-Object -TypeName System.Net.WebClient - $webClient.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$env:APPVEYOR_JOB_ID", "$env:TEMP\PesterResults.xml") + + # Report every test once on the Tests tab. An uploaded NUnit file lists a + # Pester 5 test once for each block that contains it. + if ($env:APPVEYOR_API_URL -and $result.Tests) { + $tests = @(foreach ($test in $result.Tests) { + @{ + testName = $test.ExpandedPath + testFramework = 'Pester' + fileName = Split-Path -Path $test.ScriptBlock.File -Leaf + outcome = if ($test.Result -eq 'NotRun') { 'NotRunnable' } else { "$($test.Result)" } + durationMilliseconds = [long] $test.Duration.TotalMilliseconds + ErrorMessage = @($test.ErrorRecord | ForEach-Object -Process { "$_" }) -join [Environment]::NewLine + } + }) + $body = [Text.Encoding]::UTF8.GetBytes((ConvertTo-Json -InputObject $tests -Compress)) + Invoke-RestMethod -Method Post -Uri ($env:APPVEYOR_API_URL.TrimEnd('/') + '/api/tests/batch') -Body $body -ContentType 'application/json; charset=utf-8' | Out-Null } if ($result.FailedCount -gt 0) { throw "$($result.FailedCount) Pester tests failed."