-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Mock timers broken with 20.12.0 / 21.7.0 #52325
Comments
There were two changes to mock timers in those new releases: #51809 and #51673. My guess would be that #51673 is the culprit. As an aside, I don't believe the extra awaits added in apollographql/apollo-client-nextjs#266 are necessary. As a general rule, you should only need to |
I haven't worked on the mock timers code before, so cc @Benricheson101 and @benjamingr, but the problem seems to be that this line assumes that |
Thanks for looking into this!
And thanks for this as well, good to know! |
Good catch. I see what's happening, this would definitely be a pretty easy fix. I can go ahead and open a fix for it. |
Version
v20.12.0 v21.7.0
Platform
Darwin ApolloMac.lan 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64 arm Darwin
Subsystem
No response
What steps will reproduce the bug?
This test repeatedly fails in Node v20.12.0 and v21.7.0, but works in v21.11.1 and v21.6.1:
https://github.com/apollographql/apollo-client-nextjs/blob/pr/test-changes/packages/client-react-streaming/src/AccumulateMultipartResponsesLink.test.ts#L84-L170
The line that fails is https://github.com/apollographql/apollo-client-nextjs/blob/a4e19844a05d6933a4454ff80ec784394525dc7f/packages/client-react-streaming/src/AccumulateMultipartResponsesLink.test.ts#L145
which triggers a callback scheduled by
setTimeout
here.How often does it reproduce? Is there a required condition?
It fails on almost every run.
I believe in CI I could retry multiple times to make it succeed at some point, but locally it fails every time.
What is the expected behavior? Why is that the expected behavior?
The test passes in older versions without a problem.
What do you see instead?
Additional information
I'm running these tests through
tsx
, but I believe this doesn't play a role here.This is the run command:
NODE_OPTIONS="$NODE_OPTIONS --conditions=browser" TSX_TSCONFIG_PATH=./tsconfig.tests.json node --import tsx/esm --no-warnings --test src/AccumulateMultipartResponsesLink.test.ts
You can also observe this happening in our CI here so I believe this problem is not Darwin-specific.
The text was updated successfully, but these errors were encountered: