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

chore(test): use fakeTimers with setTimeout in buffer, skipUntil and window #7392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jsaguet
Copy link

@jsaguet jsaguet commented Nov 30, 2023

Description:

After checking out the rxjs repo and running the unit tests, I noticed these 3 tests were always failing. (I'm running Windows 10 with Node 20)

The issue is probably that setTimeout does not necessarily execute at the specified delay.
I tried to reproduce the test in StackBlitz and I had the exact same issue when using timeouts so close to each other.

The PR updates these tests to use fake timers to make sure the tests work as expected.

@pmoleri
Copy link

pmoleri commented Feb 20, 2024

I had the same issue when running the tests on Windows 10 [email protected].
It's very annoying to contribute when there are unrelated failing tests.

I came across this interesting stackoverflow question: https://stackoverflow.com/questions/65177373/odd-behavior-with-setinterval-in-node-js-windows-only-works-in-linux that seems to explain the issue.

fakeTimers seems to be the way to go if we don't want to slow down the tests to be consistent in different platforms.

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.

3 participants