Skip to content

test(e2e): merge duplicate tests - #384

Merged
willgosnold merged 1 commit into
mainfrom
test/merge-duplicate-e2e
Oct 27, 2026
Merged

willgosnold merged 1 commit into
mainfrom
test/merge-duplicate-e2e

Conversation

@willgosnold

@willgosnold willgosnold commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Part of #382

Problem

Step 3 of #382 lists pairs of e2e tests that share setup and actions and differ only in what they assert. Each pair builds the same repo twice and runs the same commands twice.

Change

Three merges in test/e2e.test.ts. Every assertion of both tests is kept. Three tests are removed.

Removed test Covered now by
commit records a mode the index already has commit takes a mode change to a file the fork added and records the mode the index already has
a commit that replaces staged changes in the copy says so a commit never records a tracked ignored file inside the vendored copy and says it replaced it
a fork init refuses an upstream remote that serves a different tip than the given URL the a stale mirror row of a fork init says the remote serves different commits for ${how} and names the tip on each side
  • The mode pair had identical bodies. The merged test asserts the head mode, the stored copy's mode, the working file's mode and a clean git status.
  • The ignored x.log pair had identical setup. The merged test asserts the exit code, the "replaced" line, the pinned files in head and a clean status.
  • The 2750 test is the stale-mirror scenario with the clone arranged the other way round. Its tip line moves into the loop. The table gains a third column, onRemote, so the feature row expects feature is missing on the remote and <tip> on --upstream. No branch in the test body.

Not merged: record refuses a bad change name with no hand edits. It is not a duplicate of the label loop. The loop rows each make a hand edit first. This test has none, and record() checks the name before it checks for edits (src/record.ts:679 and :692). It is the only test that fails if those two checks swap. Merging it into the loop would need either a branch in the body or the loss of that check.

Not in this PR: the 14950/14884 merge and the 3266/3331 item. The step 2 PR owns them, because it rewrites those lines (#382 (comment)).

Verification

Typecheck passes (bun run typecheck).

Touched tests, from source and against the binary (bun run build, PATCHBOOK_CMD="$PWD/dist/patchbook"): 4 pass, 0 fail in both.

Each merged assertion fails when its expectation is broken, then the edit was reverted:

Broken expectation Result
head mode 100644 to 100755 fail
stored .pb copy executable false to true fail
porcelain "" to "x" fail
"replaced" line text fail
vendor status --short clean fail
tip line (both loop rows) fail

Test count and time for test/e2e.test.ts, main then this branch, run back to back with --reporter=junit:

main this branch
tests 1699 1696
failed 0 0
test-seconds (sum of junit time) 834.6 521.8
bun test wall 835s 522s

The count drop of 3 is exact. The seconds are not a measurement of this change. Other agents were loading the machine, and three tests of under a second cannot account for 313s. Other test files are untouched.

Statement coverage, measured with the issue's harness on main and on this head (c06efe1): 5569 of 5761 statements both sides (96.67%), 0 lost. The diff lists exactly the 3 removed tests and the 4 renamed survivors.

Written with Claude Sonnet 5.5 in Claude Code

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@willgosnold
willgosnold force-pushed the test/merge-duplicate-e2e branch from c7b5639 to c06efe1 Compare October 27, 2026 18:39
@willgosnold
willgosnold merged commit 0688792 into main Oct 27, 2026
8 checks passed
@willgosnold
willgosnold deleted the test/merge-duplicate-e2e branch October 27, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant