Skip to content
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

fix global performance node 16 #412

Merged
merged 3 commits into from
Jan 28, 2022
Merged

fix global performance node 16 #412

merged 3 commits into from
Jan 28, 2022

Conversation

benjamingr
Copy link
Member

Purpose (TL;DR) - mandatory

Fixes performance on Node 16 which has a global performance but not a global Performance

cc @fatso83 @SimenB @itayperry

@codecov
Copy link

codecov bot commented Jan 26, 2022

Codecov Report

Merging #412 (44309b4) into master (1b1ac4a) will decrease coverage by 0.11%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #412      +/-   ##
==========================================
- Coverage   94.29%   94.17%   -0.12%     
==========================================
  Files           1        1              
  Lines         613      618       +5     
==========================================
+ Hits          578      582       +4     
- Misses         35       36       +1     
Flag Coverage Δ
unit 94.17% <87.50%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/fake-timers-src.js 94.17% <87.50%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b1ac4a...44309b4. Read the comment docs.

@itayperry itayperry mentioned this pull request Jan 26, 2022
Copy link
Contributor

@fatso83 fatso83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big <3 for this. Just a question before merging.

src/fake-timers-src.js Outdated Show resolved Hide resolved
@benjamingr
Copy link
Member Author

Let's merge and open another PR to discuss versioning?

@fatso83
Copy link
Contributor

fatso83 commented Jan 28, 2022

I am merging and ignoring the codecov failures due to dropped coverage, but it would be good if that was analyzed somehow so that we understand why. I am guessing the various "if x is present, run this, else that" is only covered if the tests are run in several runtimes (which it is), but are the codecov results just one of these runs or the aggregated result? If the former, then it's hard to do something about it, and if the latter, it is weird that we get a drop.

@fatso83 fatso83 merged commit 16592d6 into master Jan 28, 2022
@fatso83 fatso83 deleted the fix-performance-node-16 branch January 28, 2022 11:42
fatso83 added a commit to fatso83/lolex that referenced this pull request Jan 28, 2022
fatso83 added a commit that referenced this pull request Jan 28, 2022
* Immediately return after this.skip()

Ref #412 (comment)

* Update browser list
@jakub-g
Copy link

jakub-g commented Oct 13, 2022

FWIW for future readers: using fake-timers@9.1.2 (via jest) with nodejs 16.3.0:

jest.useFakeTimers({
    now: ...
});

I still have

TypeError: Cannot assign to read only property 'performance' of object '[object global]'

Solution: either upgrade to nodejs 16.5.0+, or use

jest.useFakeTimers({
    now: ...
    doNotFake: ['performance'],
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants