-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Jest detecting open handle from shifty require #156
Comments
Hi @BoldBigflank, thanks for reporting! This isn't an issue I've seen before. Based on the error you're seeing, I would assume that it's related to a What happens when you use ES module syntax? So, try converting from: const { interpolate } = require('shifty') To: import { interpolate } from 'shifty' That should be equivalent, but perhaps there is some discrepancy in the implementation details related to Would it be possible to share the project you're experiencing this in? It's hard to tell what's causing this based in the information that's been provided so far. |
I still have the issue with shifty when I have the most bare bones example:
Here's the stack trace:
I suppose since the test is so simple, it might be something in the Jest config... |
Thanks for this additional information! I am seeing this as well, but only on Jest version 28. On version 27 and below, I do not see the error. I wonder if this is a Jest bug? In any case, I'll do some more exploration to see if there's something that can be changed within Shifty to prevent this issue. |
I'm experiencing this issue within Shifty's own tests when I upgrade to Jest 28. I'll explore a fix! |
When I checked I was using Jest v27.5.1, and for some reason attempting to get to 27.0.1 always installs 27.5.1. Thanks for checking this out, I'm glad it's not just me with this issue. |
For sure! Thanks again for reporting. Just to share, I upgraded Jest to version 28. When I run
So I think there's something that can change within Shifty to address this. I'm still digging! |
I think this is because Shifty uses a continuous heartbeat to run pending animations: Lines 212 to 217 in e4d6b40
It gets kicked off here: Line 822 in e4d6b40
This is core to Shifty's design, but it runs afoul of what Jest is expecting to happen. I think we'll need some conditional logic to prevent scheduling of a heartbeat tick if there are no pending animations. 🤔 |
@BoldBigflank I've got a bugfix in the works at #157. I also published a pre-release version of Shifty ( import { shouldScheduleUpdate } from 'shifty'
afterAll(() => {
shouldScheduleUpdate(false)
}) |
I tried out 2.19.0-0 and added the afterAll to the barebones test, and that completes with no errors, which is great. With this setup, I'd likely just add |
Awesome, thank you for checking @BoldBigflank. A more narrowly-scoped use of |
When I load shifty like so
My jest tests that load this module will not exit properly. When I run
The result suggests that the
require
is a "open handle potentially keeping Jest from exiting".I'm kind of inexperienced in this, but does this make sense even though there isn't really any Promise/async stuff happening in the require?
The text was updated successfully, but these errors were encountered: