test(cloudflare-workers): add coverage for onClose, onError, send, and close in Cloudflare Workers websocket adapter - #5145
Merged
yusukebe merged 1 commit intoJul 24, 2026
Conversation
…e-workers websocket adapter
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5145 +/- ##
==========================================
+ Coverage 79.04% 79.07% +0.03%
==========================================
Files 154 154
Lines 10779 10779
Branches 2256 2256
==========================================
+ Hits 8520 8524 +4
+ Misses 2259 2255 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
yusukebe
approved these changes
Jul 24, 2026
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.
Summary
Adds tests for previously untested code in the Cloudflare Workers websocket
adapter (
src/adapter/cloudflare-workers/websocket.ts):onCloseevent handlingonErrorevent handlingWSContext.send()WSContext.close()Why
While looking at #4603, I noticed these code paths had no test coverage
(lines 22, 31, 37, 43). This doesn't fix that issue, but adds regression
protection around the close/error/send handling it touches on.
Coverage for this file went from 73.91% statements / 60% branch / 50%
functions to 100% statements / 90% branch / 100% functions.
Testing
bun run testpasses locally.