Skip to content

test(bundle): share the config-probe, comment and request-sequence helpers across bundle suites - #273

Merged
jeefy merged 1 commit into
cncf:mainfrom
jeefy:test/bundle-shared-helpers
Oct 3, 2026
Merged

jeefy merged 1 commit into
cncf:mainfrom
jeefy:test/bundle-shared-helpers

Conversation

@jeefy

@jeefy jeefy commented Oct 3, 2026

Copy link
Copy Markdown
Member

Description

bundle.test.ts, triggerTestAndLgtmCancel.test.ts and collaborationCommands.test.ts each declared their own copies of the same helpers. They now import them from __tests__/bundle/helpers.ts. It exports only the helpers that at least two of these suites use, each with the signature of the most general existing copy:

  • repo, token
  • comment(body, author?): the issue_comment payload on issue Bump acorn from 5.7.3 to 5.7.4 #1
  • configReads({ org?, repo? }): the loader's 10 configuration probes (org .project/.github prow.yaml, then the 8 repo paths), stopping where a tier's file is found
  • ownersReads, ownersProbe, queueRead, membershipReads(login)
  • helpersFor(() => gh) returns calls(), expectRequests(reads, rest), expectCommandThenConfig(command, tail?, commandReads?) and routeOwners(ownersFiles, files, pull?). These act on the suite's fake GitHub. They take a getter because the suite binds them before beforeAll starts the fake.

bundle.test.ts's expectCommandThenSweep was the trigger suite's expectCommandThenConfig with no commandReads, so the two are now one helper. The collaboration suite's three-read membershipReads is renamed membershipOrCommentReads and built on the shared two-read membershipReads.

The open bundle-test PRs (#242, #244, #246, #250, #252, #260, #262, #270) can import from here instead of copying these. repoLabels, yamlFile, openPr, forkPr, routeList and labelsRead stay in bundle.test.ts because only that suite uses them. Move them to helpers.ts when a second suite needs one.

Testing

  • Tests: npx vitest run __tests__/bundle passes 125 tests both before and after the change (88 + 21 + 14 + 2). The full npm test passes 1556, with test names identical to main.
  • Assertion counts: per-test counts match main, except the three former expectCommandThenSweep callers. Each now also runs the empty commandReads check ([] equals []).
  • Lint: npm run lint reports no new findings.
  • Scope: nothing in src/ or dist/ changes. Net change is −24 lines.

…lpers across bundle suites

bundle.test.ts, triggerTestAndLgtmCancel.test.ts and collaborationCommands.test.ts each declared their
own copies; __tests__/bundle/helpers.ts now exports the ones at least two of them use: repo, token,
comment(), configReads(), ownersReads, ownersProbe, queueRead and membershipReads(), plus calls(),
expectRequests(), expectCommandThenConfig() and routeOwners() bound to a suite's fake through
helpersFor(() => gh). The trigger suite's expectCommandThenConfig() was the general form of
bundle.test.ts's expectCommandThenSweep(), so the two are now one helper.

Test names and counts are unchanged (125 bundle tests, 1556 in all).

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Signed-off-by: Jeffrey Sica <me@jeefy.dev>
@jeefy
jeefy requested a review from jpmcb as a code owner October 3, 2026 04:29
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Please add a kind label with /kind failing-test or /kind cleanup.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant