Skip to content

Resolve jest/expect-expect warnings and stabilize flaky app runner test#1917

Merged
pmcelhaney merged 3 commits intomainfrom
copilot/resolve-jest-expect-expect-warnings
Apr 16, 2026
Merged

Resolve jest/expect-expect warnings and stabilize flaky app runner test#1917
pmcelhaney merged 3 commits intomainfrom
copilot/resolve-jest-expect-expect-warnings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Summary

This PR resolves the jest/expect-expect warning sites in helper-driven RawHttpClient tests and also addresses follow-up CI feedback by fixing a flaky unit test in test/app.test.ts.

  • Added explicit assertions to helper-driven RawHttpClient tests that previously relied on “no throw” behavior.
  • Kept scope narrow (test-only changes; no eslint rule/config changes).
  • Fixed CI test instability by making the app runner selection assertion deterministic (keyed by spec group rather than async completion order).

Assertion updates

  • Updated warning sites in test/repl/raw-http-client.test.ts to assert captured request lines explicitly.
const raw = await capture;
expect(raw).toMatch(/^GET \/pets HTTP\/1\.1/);

CI follow-up fix

  • Updated test/app.test.ts (uses the first spec's runner as primary...) to avoid depending on race-prone ordering of async mocked ApiRunner.create calls.
  • The test now captures runners by group (v1/v2) and asserts primary runner identity via the v1 group.
Original Prompt

Resolve jest/expect-expect warnings

Address jest/expect-expect warnings by adding explicit assertions or using approved assertion patterns for helper-driven tests.

Context and motivation

Some tests rely on side-effect or thrown-error pathways that are not always detected by the rule. We should make assertions explicit where practical.

Acceptance criteria

  • Current warning sites are triaged
  • Tests that can include direct assertions are updated
  • Legitimate helper patterns are configured or suppressed in a narrow, documented way
  • Net warning count for this rule is reduced

Manual acceptance tests

  • In test/repl/raw-http-client.test.ts, the JSON/invalid-JSON/plain-text helper-driven tests each contain an explicit expect(...) assertion instead of only awaiting side effects.
  • Running yarn lint does not report jest/expect-expect warnings for test/repl/raw-http-client.test.ts.
  • Running yarn test --coverage=false test/app.test.ts passes consistently, including uses the first spec's runner as primary....
  • Running yarn test passes the full unit suite without the prior flaky failure in test/app.test.ts.

Tasks

  • Identify and triage jest/expect-expect warning locations.
  • Add direct assertions in helper-driven RawHttpClient tests.
  • Investigate CI failure from PR feedback and isolate failing unit test.
  • Refactor failing app test assertion to deterministic group-based runner capture.
  • Validate with targeted tests and full unit suite.

Copilot AI linked an issue Apr 16, 2026 that may be closed by this pull request
4 tasks
@pmcelhaney pmcelhaney marked this pull request as ready for review April 16, 2026 15:30
Copilot AI changed the title [WIP] Fix jest/expect-expect warnings in tests Resolve jest/expect-expect warnings in helper-driven RawHttpClient tests Apr 16, 2026
Copilot AI requested a review from pmcelhaney April 16, 2026 15:41
@pmcelhaney pmcelhaney enabled auto-merge April 16, 2026 15:54
@pmcelhaney
Copy link
Copy Markdown
Collaborator

@copilot fix failing tests

auto-merge was automatically disabled April 16, 2026 16:21

Head branch was pushed to by a user without write access

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 16, 2026

@copilot fix failing tests

Fixed in 2e2b256. I stabilized the failing test/app.test.ts case by recording mocked runners by spec group (v1/v2) instead of relying on async completion order, and verified with yarn test --coverage=false test/app.test.ts plus full yarn test.

Copilot AI changed the title Resolve jest/expect-expect warnings in helper-driven RawHttpClient tests Resolve jest/expect-expect warnings and stabilize flaky app runner test Apr 16, 2026
Copilot AI requested a review from pmcelhaney April 16, 2026 16:23
@pmcelhaney pmcelhaney enabled auto-merge April 16, 2026 16:50
@pmcelhaney pmcelhaney added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit b732a8f Apr 16, 2026
8 of 10 checks passed
@pmcelhaney pmcelhaney deleted the copilot/resolve-jest-expect-expect-warnings branch April 16, 2026 17:00
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.

Resolve jest/expect-expect warnings

2 participants