Re-enable WebSocket invalid-server test (fixes #131)#162
Merged
bghgary merged 3 commits intoBabylonJS:mainfrom Apr 17, 2026
Merged
Re-enable WebSocket invalid-server test (fixes #131)#162bghgary merged 3 commits intoBabylonJS:mainfrom
bghgary merged 3 commits intoBabylonJS:mainfrom
Conversation
The flake reported in BabylonJS#131 was resolved by BabylonJS#150 (UrlLib onError/onClose consolidation) and BabylonJS#160 (spec-compliant close/send). Verified via repro PR BabylonJS#161 which ran 20 iterations of this test across all platform/engine combos with zero failures. Fixes BabylonJS#131. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Re-enables the previously commented-out WebSocket unit test that verifies onerror is triggered when connecting to an invalid server, addressing the flake tracked in #131 after upstream WebSocket fixes landed.
Changes:
- Restore the
"should trigger error callback with invalid server"WebSocket test in the unit test suite.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Match the invalid-domain test pattern: set 10s timeout, assert errorFired from onclose rather than calling done() directly from onerror. This is more robust on slow-CI/DNS paths and aligns with the terminal-event semantics consolidated in BabylonJS#150. - Use RFC 2606 reserved 'example.invalid' instead of a randomly-generated real .com domain, which could theoretically be registered and make the test non-deterministic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
example.invalid takes >10s to dispatch onerror on Win32_x86_Chakra (DNS path for reserved .invalid TLD goes somewhere slow). The UUID-based .com hostname reliably fires onerror in ~30ms on all platforms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ryantrem
approved these changes
Apr 17, 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.
[Created by Copilot on behalf of @bghgary]
Re-enable the "should trigger error callback with invalid server" WebSocket test that was commented out in #130 due to the flake reported in #131.
Why this is safe to re-enable
Two WebSocket-related fixes landed on
mainsince the flake was observed:onError/onClosedispatch on Windows and Apple. Before this, the Windows and Apple implementations only firedonErroron connection failures without a matchingonClose, leaving consumers (and this test) in inconsistent terminal-event states.close()idempotent andsend()spec-compliant when CLOSING/CLOSED, fixing cross-state dispatch bugs.Verification
Repro PR #161 expanded this test to 20 sequential iterations on the same branch to exercise the historical 1/3 flake rate. If the flake persisted, P(all 20 pass) ≈ 0.03%. CI on #161 ran across every platform/engine combo — Chakra/V8/JSI on UWP/Win32, Linux (gcc, clang, sanitizers, TSan), macOS (Xcode 16.4, sanitizers, TSan), iOS (Xcode 15.2, 16.4) — and all 20 iterations passed on every job (workflow run 24587856930).
This PR restores the original single test (no loop, default mocha timeout) as it was before #130.
Fixes #131.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com