From 4f5325cf4ea92e93475b708e3671af31e2cd4451 Mon Sep 17 00:00:00 2001 From: Yaroslav Admin Date: Sun, 28 Mar 2021 16:22:25 +0200 Subject: [PATCH] fix: fix running tests in IE9 So the symptom is that after Karma page is loaded in IE9 the tests don't run and Karma is stuck at the "starting" step. Reloading the page once or twice makes IE9 connect to the server and tests pass successfully. After an "exciting" debugging session I figured out that the problem is that on the first load (and sometimes after the page reload) [`io` variable](https://github.com/karma-runner/karma/blob/026fff870913fb6cd2858dd962935dc74c92b725/client/main.js#L14), which should be set by the `socket.io.js` script is undefined. It looks like IE9 silently stops executing `socket.io.js` script somewhere midway and switches to the next script causing the `io` variable to be undefined. I assume it hits some limit or threshold or whatnot. Couldn't find much information on the Internet, besides people experiencing similar issues when loading e.g. unminified jQuery and their own code firing before the `$` variable is available. No good solutions found. Checking the `socket.io.js` contents, I have noticed that v2 served the minified client script on that path, while v3 now serves the unminified code. Presumably the huge script size is what causing IE9 to choke. Switching back to the minified socket.io client bundle allows tests to pass in IE9. With the fix, tests passed 5 times in a row, while without it they fail every time, so I assume it does resolve the problem. Fixes #3665 --- static/client.html | 2 +- static/client_with_context.html | 2 +- test/client/karma.conf.js | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/static/client.html b/static/client.html index 9bc16cbce..4e069e1ef 100644 --- a/static/client.html +++ b/static/client.html @@ -109,7 +109,7 @@

Karma - starting

- + diff --git a/static/client_with_context.html b/static/client_with_context.html index e562bdee1..9f5f4b21b 100644 --- a/static/client_with_context.html +++ b/static/client_with_context.html @@ -104,7 +104,7 @@ - +