Skip to content

Re-enable WebSocket invalid-server test (fixes #131)#162

Merged
bghgary merged 3 commits intoBabylonJS:mainfrom
bghgary:fix/re-enable-invalid-server-test
Apr 17, 2026
Merged

Re-enable WebSocket invalid-server test (fixes #131)#162
bghgary merged 3 commits intoBabylonJS:mainfrom
bghgary:fix/re-enable-invalid-server-test

Conversation

@bghgary
Copy link
Copy Markdown
Contributor

@bghgary bghgary commented Apr 17, 2026

[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 main since the flake was observed:

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

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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Tests/UnitTests/Scripts/tests.ts
Comment thread Tests/UnitTests/Scripts/tests.ts
bghgary and others added 2 commits April 17, 2026 15:03
- 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>
@bghgary bghgary merged commit e2ea160 into BabylonJS:main Apr 17, 2026
18 checks passed
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.

WebSocket invalid server does not invoke onerror reliably

3 participants