From d4b60c036fe1bf44635c176399aaa9609f033496 Mon Sep 17 00:00:00 2001 From: Gary Hsu Date: Fri, 17 Apr 2026 14:39:13 -0700 Subject: [PATCH] Repro: uncomment WebSocket invalid-server test x20 for issue #131 DO NOT MERGE. Expands the test to 20 iterations so CI catches the ~1/3 flake rate reported in issue #131. If CI passes, our fixes (#150, #160) resolved the issue and we can re-enable the single test in a follow-up. If CI fails, flake persists and needs more investigation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Tests/UnitTests/Scripts/tests.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Tests/UnitTests/Scripts/tests.ts b/Tests/UnitTests/Scripts/tests.ts index cffe0060..2e19f1ef 100644 --- a/Tests/UnitTests/Scripts/tests.ts +++ b/Tests/UnitTests/Scripts/tests.ts @@ -526,13 +526,18 @@ if (hostPlatform !== "Unix") { }; }); - // TODO: This is not working reliably: see https://github.com/BabylonJS/JsRuntimeHost/issues/131 - // it("should trigger error callback with invalid server", function (done) { - // const ws = new WebSocket("wss://caddddfd-ee88-4771-b293-8a8e13b330ee.com"); - // ws.onerror = () => { - // done(); - // }; - // }); + // Repro for https://github.com/BabylonJS/JsRuntimeHost/issues/131 + // Issue reports ~1/3 flake rate. Running 20 iterations so that if the + // flake still exists, P(all pass) = (2/3)^20 ≈ 0.03%. + for (let i = 1; i <= 20; i++) { + it(`should trigger error callback with invalid server (iter ${i})`, function (done) { + this.timeout(15000); + const ws = new WebSocket("wss://caddddfd-ee88-4771-b293-8a8e13b330ee.com"); + ws.onerror = () => { + done(); + }; + }); + } it("should trigger error callback with invalid domain", function (done) { this.timeout(10000);