Skip to content

Releases.Tests.ps1: replace hardcoded external dependency on ryanoasis/nerd-fonts #591

@MariusStorhaug

Description

Releases.Tests.ps1 contains one It block that exercises Get-GitHubRelease piping into Get-GitHubReleaseAsset — a valid pipeline-input code path worth testing. Today that block uses the public third-party repository ryanoasis/nerd-fonts as its data source.

Request

What is confusing or missing

The test has no connection to nerd-fonts as a concept. The repository is used purely because it has a release with many large assets attached — a property that any repository with release assets has. Using an external repository introduces a class of failures that have nothing to do with the module under test:

  • The release, its tag, or its assets could be removed or renamed at any time by a third party.
  • GitHub rate-limits unauthenticated and authenticated requests. A release with many large assets puts extra pressure on the shared secondary rate limit budget that #541 was specifically designed to protect.
  • The test is blocked in air-gapped or restricted environments.
  • The assertion is implicitly coupled to the shape of nerd-fonts releases (many assets, specific content types) — that shape can change.

The test should use assets already uploaded to the shared test repository during the same context BeforeAll, which the Release Assets sub-context creates specifically for this purpose. Those assets exist for the full duration of the test run and cover all content types needed to exercise the pipeline path.

Acceptance criteria

  • The Get-GitHubReleaseAsset - Gets assets from release using pipeline test no longer references any repository outside PSModule or the test account family (psmodule-test-org, psmodule-test-org2, etc.).
  • The test continues to verify that a Get-GitHubRelease result can be piped into Get-GitHubReleaseAsset and that the returned collection matches the [GitHubReleaseAsset] type contract.
  • The test uses assets from the shared test repository that were already uploaded in the same Release Assets context BeforeAll.
  • No new API calls to third-party repositories are made anywhere in the test suite.

Technical decisions

Replacement source: The Release Assets sub-context in Releases.Tests.ps1 already uploads several assets (TextFile.txt, Documentation.md, Config.json, Data.xml, Records.csv, a ZIP) to the latest release on $repo in its BeforeAll. That release is available as $release within the context. The pipeline test should call Get-GitHubRelease -Owner $Owner -Repository $repo and pipe to Get-GitHubReleaseAsset — identical pipeline semantics, internal data source.

Assertion adjustment: The existing assertions check $assets.Count | Should -BeGreaterThan 0 and validate each asset's type contract. The count and content-type values will reflect the test-controlled assets rather than nerd-fonts, so the count assertion stays valid (-BeGreaterThan 0) or can be made exact if desired. The per-asset assertions are already property-shape checks and require no changes.

No structural change needed: The replacement is a one-line change to the Get-GitHubRelease call — swap Owner ryanoasis -Repository nerd-fonts for -Owner $Owner -Repository $repo. The rest of the It block is unchanged.


Implementation plan

Core changes

  • Replace Get-GitHubRelease -Owner ryanoasis -Repository nerd-fonts with Get-GitHubRelease -Owner $Owner -Repository $repo in the Get-GitHubReleaseAsset - Gets assets from release using pipeline test in tests/Releases.Tests.ps1

Verification

  • Confirm the replacement It block is inside the Release Assets sub-context (so $release and $repo are in scope)
  • Confirm no other test file references any repository outside the test account family

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions