-
Notifications
You must be signed in to change notification settings - Fork 107
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
Breaks on Node 16 #394
Comments
@mroderick Thoughts on this (ref 0b1834a)? Just came across this. Might tangentially touch work currently done by @itayperry .
What happens is that the |
Node.js 16 has global |
What does that mean? Does it means it is not present on |
In node 16
|
@hexeberlin and I made all the sinon repositories use GitHub Actions in the same day. In the parent commit b3557ef, you can see this. Unfortunately, we couldn't run the |
fake-timers/src/fake-timers-src.js Lines 154 to 156 in 93f3f62
|
@itayperry The stuff you did in #400 seemed to touch upon this. Want to merge that before we look more into this? |
The major difference between node 14 and node 16 appears to be the introduction of global.performance in v16. In v14, performancePresent resolves to One other delta that I noticed while stepping through the code was that EDIT:
However, neither of them are enumerable/writeable, and the performance member itself on global is enumerable:
When I hope this helps to debug the issue. |
Yes, of course! I'd be happy to do it :) I'll speed it up. |
@itayperry Any chances of you looking into this? Seems you already did all the work 😄 |
@fatso83 |
Hi, I don't know if I'm doing this right.. but I'm using
I guess I'm doing something wrong. Okay, update (Jan 25th): this issue was opened before the latest merged PR - #400 (which is mine I'm afraid) - it's just a small condition that caused the other 64 to fail, not a problem, I'll fix it :) fake-timers/src/fake-timers-src.js Line 1675 in 1b1ac4a
There are truly only 3 failed tests on Node 16 . I'm working on it :)
|
About these 2 tests: fake-timers/test/fake-timers-test.js Line 3758 in 1b1ac4a
b) fake-timers/test/fake-timers-test.js Line 3778 in 1b1ac4a
They both use InternalPerformance.prototype.constructor = Performance.prototype.constructor;
ObjectSetPrototypeOf(InternalPerformance.prototype, Performance.prototype); performance: new InternalPerformance() but I'm afraid I can't use it / access it.. it would be nice if we could use What do you think we should do with these specific tests? Can we just skip them when in |
I made a stupid workaround that happens to work in my particular use case if anyone else is hitting this issue and wants to give it a try. I basically just made my own global fake I've got this in my unit test setup that gets pulled in prior to anyone calling global.Performance = global.Performance || class Perf {
clearMarks() { return global.performance.clearMarks(); }
clearMeasures() { return global.performance.clearMeasures(); }
clearResourceTimings() { return global.performance.clearResourceTimings(); }
getEntries() { return global.performance.getEntries(); }
getEntriesByName() { return global.performance.getEntriesByName(); }
getEntriesByType() { return global.performance.getEntriesByType(); }
mark() { return global.performance.mark(); }
measure() { return global.performance.measure(); }
now() { return global.performance.now(); }
setResourceTimingBufferSize() { return global.performance.setResourceTimingBufferSize(); }
toJSON() { return global.performance.toJSON(); }
}; |
Hey sorry this has been open for a while and I need this to work in my project so I'm going to go ahead and fix it - let me know if you want to sync on other stuff to work on. |
@benjamingr Anyway, thank you for your help in #412!! |
Can be closed :) |
It looks like this will need to be bumped over in
|
Hrm. So, the fix works but makes the assumption that the functions on This isn't necessarily a bug with either library, but feels like a gap between the two. However, The work around that I posted above still works in this case as long as its injected prior to sinon & jsdom, so I'm not blocked by any means, but just requires making sure that happens in my tests everywhere. |
@msluther to understand your use case better - you are using a library (e.g. for testing) that sets your global object to a JSDom window? If so - I think it's probably reasonable to account for then yes - can you open a separate issue? |
Yep, thats correct its basically this in my test setup: |
Currently, the tests are failing in node 16. Figure out why, fix it, and adjust GitHub actions workflow to use node 16 instead of 10.
The text was updated successfully, but these errors were encountered: