-
Notifications
You must be signed in to change notification settings - Fork 309
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: support timers getting stubbed #1125
fix: support timers getting stubbed #1125
Conversation
Not sure what went on there in the build, did run the tests on node, chrome and firefox locally. Also if you want me to remove the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. I just have a couple of API requests.
src/core/lib/common/util.ts
Outdated
@@ -1028,3 +1028,10 @@ export function errorToJSON(error?: InternError): InternError | undefined { | |||
...(showDiff ? { actual, expected } : {}) | |||
}; | |||
} | |||
|
|||
export const originalTimers = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we export these from a new lib/common/time
module, with a comment at the top explaining why we need it? Also, rather than dateNow, how about just now
? Then we could do
import { setTimeout, now } from './common/time';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is much nicer and changes have been made
3fe7075
to
a0ea32e
Compare
- If using a library to stub timers it interferes with the timing functions used by Suites and Tests - Tests were written using TDD
a0ea32e
to
1c670fd
Compare
Codecov Report
@@ Coverage Diff @@
## master #1125 +/- ##
==========================================
+ Coverage 57.44% 57.69% +0.25%
==========================================
Files 95 96 +1
Lines 8909 8962 +53
Branches 2046 2059 +13
==========================================
+ Hits 5118 5171 +53
Misses 3791 3791
Continue to review full report at Codecov.
|
@jason0x43 Is there any chance of getting this change into the next 4.8.X release? |
Yes, that should be doable |
Great, thanks! |
functions used by Suites and Tests