"Uncaught TypeError: io.connect is not a function" in `testem_connection.js`

This issue has been tracked since 2021-10-15.

After the upgrade from socket.io v2.x to v4.x, TestEm is throwing a TypeError when referencing io.connect():

not ok 1 Chrome - [undefined ms] - error
    ---
        message: >
            Error: Browser failed to connect within 30s. testem.js not loaded?
            Stderr:

            DevTools listening on ws://127.0.0.1:39645/devtools/browser/dc792e0a-a949-4a03-8490-55fb75e21791
            [1014/201022.416812:ERROR:gpu_init.cc(426)] Passthrough is not supported, GL is disabled
            [1014/201023.140386:INFO:CONSOLE(54398)] "DEBUG: -------------------------------", source: http://localhost:36173/assets/vendor.js (54398)
            [1014/201023.140717:INFO:CONSOLE(54398)] "DEBUG: Ember      : 3.20.7", source: http://localhost:36173/assets/vendor.js (54398)
            [1014/201023.140736:INFO:CONSOLE(54398)] "DEBUG: Ember Data : 3.20.5", source: http://localhost:36173/assets/vendor.js (54398)
            [1014/201023.140748:INFO:CONSOLE(54398)] "DEBUG: jQuery     : 3.6.0", source: http://localhost:36173/assets/vendor.js (54398)
            [1014/201023.140756:INFO:CONSOLE(54398)] "DEBUG: -------------------------------", source: http://localhost:36173/assets/vendor.js (54398)
            [1014/201023.229048:INFO:CONSOLE(178)] "Uncaught TypeError: io.connect is not a function", source: http://localhost:36173/testem/testem_connection.js (178)
            [1014/201024.271830:INFO:CONSOLE(967)] "DEPRECATION: Using this.$() in a component has been deprecated, consider using this.element [deprecation id: ember-views.curly-components.jquery-element] See https://emberjs.com/deprecations/v3.x#toc_jquery-apis for more details.
                    at logDeprecationStackTrace (http://localhost:36173/assets/vendor.js:54668:21)
                    at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)
                    at raiseOnDeprecation (http://localhost:36173/assets/vendor.js:54695:9)
                    at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)
                    at invoke (http://localhost:36173/assets/vendor.js:54777:9)
                    at Object.deprecate (http://localhost:36173/assets/vendor.js:54733:28)
                    at Class.$ (http://localhost:36173/assets/vendor.js:83937:34)
                    at Class.renderReCaptcha (http://localhost:36173/assets/vendor.js:123860:30)
                    at http://localhost:36173/assets/vendor.js:123899:14", source: http://localhost:36173/testem.js (967)
            [1014/201024.272538:INFO:CONSOLE(967)] "DEPRECATION: Use of `merge` has been deprecated. Please use `assign` instead. [deprecation id: ember-polyfills.deprecate-merge] See https://emberjs.com/deprecations/v3.x/#toc_ember-polyfills-deprecate-merge for more details.
                    at logDeprecationStackTrace (http://localhost:36173/assets/vendor.js:54668:21)
                    at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)
                    at raiseOnDeprecation (http://localhost:36173/assets/vendor.js:54695:9)
                    at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)
                    at invoke (http://localhost:36173/assets/vendor.js:54777:9)
                    at deprecate (http://localhost:36173/assets/vendor.js:54733:28)
                    at Object.merge (http://localhost:36173/assets/vendor.js:59143:47)
                    at Class.renderReCaptcha (http://localhost:36173/assets/vendor.js:123862:32)
                    at http://localhost:36173/assets/vendor.js:123899:14", source: http://localhost:36173/testem.js (967)
            [1014/201025.675559:INFO:CONSOLE(967)] "DEPRECATION: Using this.$() in a component has been deprecated, consider using this.element [deprecation id: ember-views.curly-components.jquery-element] See https://emberjs.com/deprecations/v3.x#toc_jquery-apis for more details.
                    at logDeprecationStackTrace (http://localhost:36173/assets/vendor.js:54668:21)
                    at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)
                    at raiseOnDeprecation (http://localhost:36173/assets/vendor.js:54695:9)
                    at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)
                    at invoke (http://localhost:36173/assets/vendor.js:54777:9)
                    at Object.deprecate (http://localhost:36173/assets/vendor.js:54733:28)
                    at Class.$ (http://localhost:36173/assets/vendor.js:83937:34)
                    at Class.renderReCaptcha (http://localhost:36173/assets/vendor.js:123860:30)
                    at http://localhost:36173/assets/vendor.js:123899:14", source: http://localhost:36173/testem.js (967)
            [1014/201025.675906:INFO:CONSOLE(967)] "DEPRECATION: Use of `merge` has been deprecated. Please use `assign` instead. [deprecation id: ember-polyfills.deprecate-merge] See https://emberjs.com/deprecations/v3.x/#toc_ember-polyfills-deprecate-merge for more details.
                    at logDeprecationStackTrace (http://localhost:36173/assets/vendor.js:54668:21)
                    at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)
                    at raiseOnDeprecation (http://localhost:36173/assets/vendor.js:54695:9)
                    at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)
                    at invoke (http://localhost:36173/assets/vendor.js:54777:9)
                    at deprecate (http://localhost:36173/assets/vendor.js:54733:28)
                    at Object.merge (http://localhost:36173/assets/vendor.js:59143:47)
                    at Class.renderReCaptcha (http://localhost:36173/assets/vendor.js:123862:32)
                    at http://localhost:36173/assets/vendor.js:123899:14", source: http://localhost:36173/testem.js (967)


        browser log: |
            {"type":"error","text":"Error: Browser failed to connect within 30s. testem.js not loaded?"}
            {"type":"error","text":"\nDevTools listening on ws://127.0.0.1:39645/devtools/browser/dc792e0a-a949-4a03-8490-55fb75e21791\n[1014/201022.416812:ERROR:gpu_init.cc(426)] Passthrough is not supported, GL is disabled\n[1014/201023.140386:INFO:CONSOLE(54398)] \"DEBUG: -------------------------------\", source: http://localhost:36173/assets/vendor.js (54398)\n[1014/201023.140717:INFO:CONSOLE(54398)] \"DEBUG: Ember      : 3.20.7\", source: http://localhost:36173/assets/vendor.js (54398)\n[1014/201023.140736:INFO:CONSOLE(54398)] \"DEBUG: Ember Data : 3.20.5\", source: http://localhost:36173/assets/vendor.js (54398)\n[1014/201023.140748:INFO:CONSOLE(54398)] \"DEBUG: jQuery     : 3.6.0\", source: http://localhost:36173/assets/vendor.js (54398)\n[1014/201023.140756:INFO:CONSOLE(54398)] \"DEBUG: -------------------------------\", source: http://localhost:36173/assets/vendor.js (54398)\n[1014/201023.229048:INFO:CONSOLE(178)] \"Uncaught TypeError: io.connect is not a function\", source: http://localhost:36173/testem/testem_connection.js (178)\n[1014/201024.271830:INFO:CONSOLE(967)] \"DEPRECATION: Using this.$() in a component has been deprecated, consider using this.element [deprecation id: ember-views.curly-components.jquery-element] See https://emberjs.com/deprecations/v3.x#toc_jquery-apis for more details.\n        at logDeprecationStackTrace (http://localhost:36173/assets/vendor.js:54668:21)\n        at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)\n        at raiseOnDeprecation (http://localhost:36173/assets/vendor.js:54695:9)\n        at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)\n        at invoke (http://localhost:36173/assets/vendor.js:54777:9)\n        at Object.deprecate (http://localhost:36173/assets/vendor.js:54733:28)\n        at Class.$ (http://localhost:36173/assets/vendor.js:83937:34)\n        at Class.renderReCaptcha (http://localhost:36173/assets/vendor.js:123860:30)\n        at http://localhost:36173/assets/vendor.js:123899:14\", source: http://localhost:36173/testem.js (967)\n[1014/201024.272538:INFO:CONSOLE(967)] \"DEPRECATION: Use of `merge` has been deprecated. Please use `assign` instead. [deprecation id: ember-polyfills.deprecate-merge] See https://emberjs.com/deprecations/v3.x/#toc_ember-polyfills-deprecate-merge for more details.\n        at logDeprecationStackTrace (http://localhost:36173/assets/vendor.js:54668:21)\n        at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)\n        at raiseOnDeprecation (http://localhost:36173/assets/vendor.js:54695:9)\n        at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)\n        at invoke (http://localhost:36173/assets/vendor.js:54777:9)\n        at deprecate (http://localhost:36173/assets/vendor.js:54733:28)\n        at Object.merge (http://localhost:36173/assets/vendor.js:59143:47)\n        at Class.renderReCaptcha (http://localhost:36173/assets/vendor.js:123862:32)\n        at http://localhost:36173/assets/vendor.js:123899:14\", source: http://localhost:36173/testem.js (967)\n[1014/201025.675559:INFO:CONSOLE(967)] \"DEPRECATION: Using this.$() in a component has been deprecated, consider using this.element [deprecation id: ember-views.curly-components.jquery-element] See https://emberjs.com/deprecations/v3.x#toc_jquery-apis for more details.\n        at logDeprecationStackTrace (http://localhost:36173/assets/vendor.js:54668:21)\n        at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)\n        at raiseOnDeprecation (http://localhost:36173/assets/vendor.js:54695:9)\n        at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)\n        at invoke (http://localhost:36173/assets/vendor.js:54777:9)\n        at Object.deprecate (http://localhost:36173/assets/vendor.js:54733:28)\n        at Class.$ (http://localhost:36173/assets/vendor.js:83937:34)\n        at Class.renderReCaptcha (http://localhost:36173/assets/vendor.js:123860:30)\n        at http://localhost:36173/assets/vendor.js:123899:14\", source: http://localhost:36173/testem.js (967)\n[1014/201025.675906:INFO:CONSOLE(967)] \"DEPRECATION: Use of `merge` has been deprecated. Please use `assign` instead. [deprecation id: ember-polyfills.deprecate-merge] See https://emberjs.com/deprecations/v3.x/#toc_ember-polyfills-deprecate-merge for more details.\n        at logDeprecationStackTrace (http://localhost:36173/assets/vendor.js:54668:21)\n        at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)\n        at raiseOnDeprecation (http://localhost:36173/assets/vendor.js:54695:9)\n        at HANDLERS.<computed> (http://localhost:36173/assets/vendor.js:54765:9)\n        at invoke (http://localhost:36173/assets/vendor.js:54777:9)\n        at deprecate (http://localhost:36173/assets/vendor.js:54733:28)\n        at Object.merge (http://localhost:36173/assets/vendor.js:59143:47)\n        at Class.renderReCaptcha (http://localhost:36173/assets/vendor.js:123862:32)\n        at http://localhost:36173/assets/vendor.js:123899:14\", source: http://localhost:36173/testem.js (967)\n"}
    ...

Poking at the same error in developer mode, I can see that the io global exists, but there is no connect() method available at the point of use. I have a fix working locally, and I'll follow up with a PR here shortly.

aovchinn wrote this answer on 2021-10-15
More Details About Repo
Owner Name testem
Repo Name testem
Full Name testem/testem
Language JavaScript
Created Date 2011-07-12
Updated Date 2022-11-22
Star Count 2953
Watcher Count 71
Fork Count 409
Issue Count 127

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date