-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4.3.0 breaks testem #4121
Comments
Update: this is actually an issue in socket-io.client; please feel free to move it! |
See also: socketio/engine.io-client@00d7e7d Related: - #1188 - #1378
The change to the shape of the API was introduced here. |
A further update: it's not actually clear how or why the build worked previously on the 4.x series. As I'm looking at the shape of the modules exported, it doesn't seem like it should have. I currently suspect that the switch from webpack to Rollup changed the shape of the generated output in a way which happened to break testem; but it looks like the change to the API itself is something testem possibly should have absorbed some time ago. |
Confirmed: the output from webpack on v4.2.0 included |
Not the webpack→Rollup transition's fault—a little further digging back into the change shows what happened: changing from export * as io from './index.js'; I'm happy to open a PR to that effect |
The previous (CJS module) export semantics were of a *namespace*-style export, while the semantics introduced in c76d367 are of a single value exported as the default value instead. This broke downstream consumers who were using the namespace-style export, as documented at [socketio/socket.io#4121][4121]. While the single default export should work fine (and might be preferable!), it's a breaking change, and appears to be an *accidental* breaking change, so this reverts to the previous semantics.
Version 4.3.0 of socket.io breaks testem connection when running tests headless. Reference socketio/socket.io/issues/4121
Arf, sorry for that. export * as io from './index.js'; is bundled as: [...]
var index = /*#__PURE__*/Object.freeze({
__proto__: null,
Manager: Manager,
Socket: Socket,
io: lookup,
connect: lookup,
protocol: protocol
});
exports.io = index;
Object.defineProperty(exports, '__esModule', { value: true }); Which means the The following should work though: import { io, connect } from "./index.js";
io.connect = connect;
export default io; What do you think? |
That could work, but in that case (for the sake of backwards compatibility) we should make sure we do that for all the functions which were previously exported that way. Testem also relies on having |
Aside: JavaScript is such shenanigans. The fact that an export can be both a function and a namespace is just… 🙃😩🤪🥴 |
I've pushed an update to the PR which manually recreates the namespace in the source module, while preserving the nice new ES module exports. |
See socketio/socket.io#4121 for more info.
See socketio/socket.io#4121 for more info.
This restores the previous behavior, where the "io" object available in the browser could be used as a function (`io()`) or as a namespace (`io.connect()`). The breaking change was introduced in [1]. Related: socketio/socket.io#4121 [1]: 16b6569
This should be fixed by socketio/socket.io-client@8737d0a, which was included in ̀socket.io-client@4.3.1. |
@chriskrycho @darrachequesne I maybe missing something, as far as I can see we need a new release of E.g. Testem.js does not depend on |
@SergeAstapov yeah, you're correct—given the re-bundling pattern used |
@chriskrycho assuming ember-cli will need to cut a release once testem updates as well? (currently broken in latest 3.28) |
Shouldn't. The CI breakage is just from the Ember CI defaults of including a run which lets all dependencies resolve to their latest legal version (using If you're seeing the CI builds fail from this issue (as I have on |
ok gotcha thanks for the work & update |
This restores the previous behavior, where the "io" object available in the browser could be used as a function (`io()`) or as a namespace (`io.connect()`). The breaking change was introduced in [1]. Related: socketio/socket.io#4121 [1]: socketio/socket.io-client@16b6569
Describe the bug
As of the v4.3.0 release, testem (and therefore all CI runs which use it, so this will shortly be hitting the whole Ember.js community and any others as they upgrade or for runs which check against "drifted dependencies") is failing with the following error:
Inspecting
io
shows that it is in fact thelookup
function (dist).To Reproduce
Unfortunately, this is a bit involved, and I don't have a good minimal reproduction yet. I will add one later. For now, I will link directly to the relevant bits of testem's source.
Socket.IO server version:
4.3.0
Server
socket.io
as `const socketIO = require('socket.io');Socket.IO client version:
x.y.z
Client
/socket.io/socket.io.js
via<script>
tagio.connect
withio
as a globalExpected behavior
Given 4.3.0 was a patch release,
testem
's previous usage should continue to work without issue.Platform:
Additional context
I strongly suspect (but haven't yet been able to prove) that this is related to either the
engine.io
bump, serving ESM, or the intersection of the two.The text was updated successfully, but these errors were encountered: