-
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 and timer, test never ends. #3957
Comments
IMO, this is not a bug. Without the |
but the idea of the marble tests is that I say the expected output and check it. after the timeframe of the expectation, there is no need for the scheduler to keep running. so it could stop everything, right? |
The test scheduler will see that the output matches the expectation, but it also has an observable that's still emitting. It cannot know that it won't receive more notifications, upon receipt of which the received output would not match the expected output. If your source observable completed - i.e. ended with |
hm ok. so the expected should end with | and bla should also end with |. I will try that in a few hours and report back. is there another way I could make this happen as I want? maybe a takeuntil with some kind end observable? probably no.. |
Anything that stops the timer should work - like the Basically, you cannot leave an observable emitting and expect the test to end. Observables don't necessarily have to complete, but each time the timer emits, it schedules its next emission and that's the problem. The test infrastructure won't end the test until there are no more scheduled actions. |
indeed adding |
Bug Report
Current Behavior
i have a timer and some other streams that touch this timer.
Reproduction
i dont know how to do stackblitz with jest tests.
you can take the following code and run
jest test
, oryarn test
.Expected behavior
I want to test the above code, and i would expect that after i have gotten the expected output up to the point i have it, then it would stop the test as a success. with the current test above, the test never finishes, because i guess the timer never stops?
if i uncomment the
take
, then the test passes.Environment
Possible Solution
N/A
Additional context/Screenshots
N/A
The text was updated successfully, but these errors were encountered: