Add simple rAF polyfill in jsdom environment#4568
Conversation
|
No idea why it fails on windows. Anyone? |
|
I'm assuming it fails because we don't wait for the setTimeout, which is async, to complete, and the event loop has a different behavior on Windows |
|
Ok, tried a new approach for the test |
|
We should also keep an eye on jsdom/jsdom#1963 so that we can potentially revert this change again in the future |
|
Hmm, new test didn't help. I don't have a windows box available either. Ideas? Skipping it on windows seems like the wrong solution |
|
As said, I suspect the event loop works slightly differently on Windows. Since you are implementing it using If that doesn't work, I'm ok sipping it so we can merge it. |
|
Hmm, after logging out Not sure how that happens. I'll see if I'm able to start up a virtual machine and install git, node and yarn to test |
|
Well, upgrading to yarn 1.1.0 made appveyor green 🤷♂️ |
Codecov Report
@@ Coverage Diff @@
## master #4568 +/- ##
=========================================
+ Coverage 55.66% 56.1% +0.43%
=========================================
Files 186 185 -1
Lines 6345 6292 -53
Branches 3 3
=========================================
- Hits 3532 3530 -2
+ Misses 2812 2761 -51
Partials 1 1
Continue to review full report at Codecov.
|
| const hrInNano = hr[0] * 1e9 + hr[1]; | ||
| const hrInMicro = hrInNano / 1e6; | ||
|
|
||
| return global.setTimeout(callback, 0, hrInMicro); |
There was a problem hiding this comment.
I'm currently working on getting it upstreamed into JSDOM, so I read some of the spec. I don't know if people use this argument, or expect it to be in any way accurate, but this is a best effort 🙂
| moduleMocker: ?ModuleMocker; | ||
|
|
||
| constructor(config: ProjectConfig): void { | ||
| const jsdomInitialized = process.hrtime(); |
There was a problem hiding this comment.
I'd prefer to have it beneath the JSDom.jsdom call, but that makes stuff fail with an odd flow error...
* Add simple rAF polyfill in jsdom environment Closes jestjs#4545 * Fix flow error * Tweak test * Try to log out stderr on CI * Use snake case naming for test file * Update to newest yarn on ci * Revert "Try to log out stderr on CI" This reverts commit 08d58c5. * Remove extra -- from appveyor to avoid warning on newer yarn * Include time since window initialised in rAF implementation
|
When will this be released? |
|
It is out in 21.3.0-beta.2 |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |

Summary
Closes #4545
Test plan
Added integration test copied from
setImmediate