Skip to content

Get-Help keeps returning help it already loaded after Update-Help -Scope CurrentUser, which makes HelpSystem.Tests.ps1 flaky when $PSHOME has help #28274

Open

Description

Prerequisites

Steps to reproduce

With help installed in $PSHOME (e.g. after Update-Help -Scope AllUsers, or a distribution package that ships help), and an empty CurrentUser help folder:

# Help loaded before Update-Help is cached for the session:
pwsh -NoProfile -c "Get-Help Import-Module -Parameter NoClobber | Out-Null
  Update-Help -Module Microsoft.PowerShell.Core -SourcePath ./test/powershell/engine/Help/assets -UICulture en-US -Force -Scope CurrentUser
  (Get-Help Import-Module -Parameter NoClobber | Out-String) -match 'Aliases\s+NoOverwrite'"
False

# Without the first Get-Help, or in a new session, the new CurrentUser help is used:
True

Expected behavior

After `Update-Help`, Get-Help in the same session returns the updated help.

Actual behavior

Get-Help keeps returning the help it loaded from `$PSHOME` before the update.

This makes `test/powershell/engine/Help/HelpSystem.Tests.ps1` flaky. "Validate that get-help works for CurrentUserScope" installs the test help with `Update-Help -Scope CurrentUser`, then expects `Aliases NoOverwrite` for `Import-Module -NoClobber`. When an earlier test in the same Pester session already loaded `Import-Module` help from `$PSHOME`, it gets the shipped help instead (`Aliases none`) and fails. Your CI has no help in `$PSHOME`, so it isn't affected. "help can be found for CurrentUser Scope" removes the `$PSHOME` help first, so it isn't affected either.

That test removes help from `$PSHOME` (`Remove-Item $coreHelpFilePath` and so on), so it also deletes shipped help when the tests run against an installed or packaged PowerShell.

Error details

Environment data

PowerShell 7.6.9 on Arch Linux x86_64, built from source with en-US help installed in `$PSHOME`

Name                           Value
----                           -----
PSVersion                      7.6.9
PSEdition                      Core
GitCommitId                    7.6.9
OS                             Arch Linux
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.4
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.WG-Interactive-HelpSystemhelp infrastructure and formatting of help

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions