Repository navigation
ref(cli): Trim set-commits tests and share repository error hints - #2193
Open
sentry-junior[bot] wants to merge 1 commit into
Open
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
Remove two setCommitsAuto tests that repeat other coverage: the display-name cases already in the isSameRepository unit table, and the "no repo matches" case that the name-filter and suggestion tests cover. Swap the GitLab and Azure isSameRepository rows, which the setCommitsAuto tests also cover, for a property test of URL-path matching. Add a local jsonResponse() helper like replays.test.ts, a mockAutoFetch() router for the setCommitsAuto tests, and a ciEnv() helper so every withEnv() call keeps the test database and drops the runner's CI variables. In releases.ts, reuse CommitRef in setCommitsAuto and share the similar-repository list and the "add the repository" hint between the --auto and --commit errors. No behavior change. Co-Authored-By: bete <28983162+betegon@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up cleanup from reviewing the
set-commits --autowork (#1863–#1866) onmain. No behavior change.Tests removed (duplicate coverage)
setCommitsAuto"skips a display name whose URL points to another project" / "matches a display name when the repository has no URL": these were the same two cases as theisSameRepositoryunit table ingit.property.test.ts, wrapped in a full fetch mock. The pure-function table keeps them.setCommitsAuto"throws ValidationError when no repo matches local remote": the name-filter test and the "suggests similar repositories" test already assert the same error, and they check more.isSameRepositoryrows for GitLab and Azure URL-path matching: the GitLab and AzuresetCommitsAutotests already cover them end to end. They're replaced with one fast-check property, matching by URL path in any case whatever the display name, since CLI AGENTS.md prefers property tests for pure functions.Test helpers
jsonResponse(body, status), a local helper likereplays.test.tshas. It replaces the 45new Response(JSON.stringify(...), { headers: { "Content-Type": ... } })blocks inreleases.test.ts. The pagination test now uses the existinglinkHeader()helper.mockAutoFetch(repos)answers the repository search, the previous-release lookup and the release PUT forsetCommitsAuto, and records the queries and the refs sent. It replaces 5 hand-written copies of that router. The tests that check request details, concurrency or pagination keep their own mocks.ciEnv(vars): everywithEnv()call now keeps the test database and telemetry off and drops the runner's CI variables. Before, some calls did this and others passed{}.releases.tssetCommitsAutousesCommitRefinstead of writing the same type inline.repositorySuggestions()andaddRepositoryHint()now build the similar-repository list and the "add the repository" hint for both the--autoerror and the--commiterror. Before, each error had its own copy.ifis collapsed into one condition.Checks (in
packages/cli)pnpm run typecheckandpnpm run lintpass.vitest run test/lib/api/releases.test.ts test/lib/git.property.test.ts test/lib/ci.test.ts test/commands/release/passes (157 tests).via @betegon.
--
View Session [Sentry]