-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: Using esm
package results in an empty object in Jest >= 25
#12493
Comments
You should report this to You should use native ESM (although the segfault (argh!) probably block that) or setup That said, if you could bisect which change caused the regression, we might be able to get a fix in as long as it's not too ugly 🙂 |
Alright, thanks! I do appreciate there's likely a ton of surface area there for a pretty uncommon use case. I certainly will take a look at bisecting, see if I can track down the exact change. Definitely might be time to look for an alternative, as Do you prefer I close this as it might be an upstream issue? Assuming I can come back in say a week and update regardless depending on what I find. |
It is a regression even though we never explicitly supported |
I spent a few hours trying to bisect the issue tonight, without a ton of success. As far as I can tell, the commit that caused the issue was the 25.1.0 release itself. That being said, the only way I could actually reproduce this was by using I suppose my only guess is that it's not I also ran into all sorts of issues with |
Yeah, I'd try to add a failing test to this repo (possibly in |
Interesting. Gave that a shot, but still, on the v25.1.0 release (5dcc480), it seems to correctly run. Head of main does fail, though that's not exactly useful as 25.1.0 should be failing too. I don't think I can spend more time trying to track this down, sorry. Seems like a non-stop fight against the tooling more than anything; none of it first-party, for what it's worth, but Yarn (2+) tripping over itself and losing files, gyp, and then Babel shenanigans. Shall I close out this issue? I think we're probably pretty happy downgrading to v24.9.0 until that |
Fine by me 🙂 Note that if you install |
Ah, fair point. Might've been it, though tracking down the actual issue I imagine would still be difficult. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
27.5.1
Steps to reproduce
yarn
node index.js
-> output is{ default: [ { foo: 'bar' } ] }
yarn jest ./index.test.js
-> test fails, output is{ default: {} }
jest
to24.9.0
inpackage.json
yarn jest ./index.test.js
-> test passes, output is{ default: [ { foo: 'bar' } ] }
Expected behavior
The test should pass in newer Jest versions.
Actual behavior
The default export is always an empty object.
Additional context
Apologies for this being a bit old, but only just noticing it now. This works correctly in 24.9.0, but as of 25.0.0, it fails. Nothing in the change notes for 25 really stands out to me, and I imagine this should still function properly if it does work in Node itself without issue.
Over in preact-cli, we allow users to write their config files in ESM or CJS, resulting in this setup (use of the
esm
package). It seemingly is the only way to enable this behavior while also not breaking our test suite due to the upstreamimport()
segfault bug (nodejs/node#35889)Environment
The text was updated successfully, but these errors were encountered: