-
Notifications
You must be signed in to change notification settings - Fork 3k
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
TestScheduler seems to use bogus values for frameTimeFactor
#2475
Comments
I agree with this request. In order to fully control the time factors and max frames, I need to either ensure all time is overridable to 10ms increments or extend VirtualTimeScheduler myself and not use TestScheduler for testing. I have retry logic that waits several seconds that I'd like to test without injecting new delays into the source code. |
class TestScheduler {
static frameTimeFactor = 1;
static kickDog() {
return this.frameTimeFactor;
}
}
// compiles to
var TestScheduler = (function () {
function TestScheduler() {
}
TestScheduler.kickDog = function () {
return this.frameTimeFactor;
};
return TestScheduler;
}());
TestScheduler.frameTimeFactor = 1; In TS and JS, classes are objects themselves (not just the instances of those classes) so when calling a function (aka method in this case),
Are you actually seeing cases where |
You might also like https://www.npmjs.com/package/@kwonoj/rxjs-testscheduler-compat which was made by one of the core team members to experiment with bringing a similar api as v4 back to v5 |
Regarding @CrazyBS comment about fully controlling Say I have a stream with I'd like to test it with a marble diagram like the following, where each dash represents 5000ms instead of the default 10ms:
I feel like this would be possible if I could override Does this make sense as a feature request, or am I missing an easier way to do this? |
@kwonoj fantastic, thanks! |
This is resolved with |
RxJS version:
5.2.0
The value
frameTimeFactor
seems to be a static on VirtualTimeScheduler and used in some places in TestScheduler.In some places its used as a static, TestScheduler.ts:35
But in others its used on
this
when there is no `this:TestScheduler.ts:149
TestScheduler.ts:199
TestScheduler.ts:212
Changing
this.frameTimeFactor
toTestScheduler.frameTimeFactor
seems to fully allow for adjusting the resolution of time intervals. I believe there is a issue to that as part of testing improvements, but this is an easy fix standalone.The text was updated successfully, but these errors were encountered: