Skip to content

test(release): integration tests for release-preflight.ts live-check functions #1039

Description

@sahrizvi

Deferred from the v0.9.3 pre-release review.

Current behavior

script/release-preflight.ts has 41 unit tests covering the pure helper functions: normalizeVersion, parseSemver, compareSemver, isStableTagName, selectPrevTag, prereleaseLineTags.

Gap

The main() function's nine live gates — which shell out to run(), git(), and gh — are untested. A regression in the npm reachability branch or the gh release-blocker query logic would not surface until an actual release attempt fails on it, at which point the release is already halted and every second of debug time is on the wire.

Proposal

Add integration tests that mock the run() shim at the test-harness boundary and exercise each of the nine gates. Coverage targets:

  • Tag-collision paths — local exists, remote exists, both exist, neither exists.
  • Version-sanity failures — npm-view reachable but version already published; npm-view unreachable; malformed SemVer.
  • Prerelease-line ancestry — prerelease tag on the same minor line not an ancestor of origin/main.
  • Release-blocker query — open PR with the label; API failure; empty result.
  • PREV_TAG selection dry-run against a rigged tag graph.

Why deferred

Requires building the run() mocking harness. Test infrastructure work worth its own follow-up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions