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(tests): making the tests not change the time #472

Merged
merged 1 commit into from Apr 17, 2024
Merged

Conversation

bassrock
Copy link
Member

Goal

When I moved the list api and other services, I moved them and replaced sinon with pure jest. There was some weird behavior with the new timers behavior in Jest that I could not fully sort out at the time that caused us to have to set advanceTimers to true. This had the side effect of causing our tests that check dates to be a bit flakey because the time could increment in the amount of time it took to run the test instead of being

Upon looking into the behavior advanceTimers was needed because the new timer behavior fakes async tick functions that we don't want it to. See nock/nock#2200 (comment)

By telling jest to not fake the async node functions, the clock stays frozen and the rest of the code can execute.

@bassrock bassrock requested a review from a team as a code owner April 17, 2024 14:43
@bassrock bassrock requested review from marcin-kozinski and removed request for a team April 17, 2024 14:43
@bassrock bassrock requested review from kschelonka and removed request for marcin-kozinski April 17, 2024 14:51
@bassrock bassrock enabled auto-merge April 17, 2024 14:51
Copy link
Contributor

@kschelonka kschelonka left a comment

Choose a reason for hiding this comment

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

@bassrock bassrock added this pull request to the merge queue Apr 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 17, 2024
@bassrock bassrock added this pull request to the merge queue Apr 17, 2024
@bassrock bassrock removed this pull request from the merge queue due to a manual request Apr 17, 2024
@pocket-github-bot
Copy link

pocket-github-bot bot commented Apr 17, 2024

Plan Result (user-list-search-cdk)

CI link

No changes. Your infrastructure matches the configuration.

@bassrock bassrock added this pull request to the merge queue Apr 17, 2024
Merged via the queue into main with commit 8cd1630 Apr 17, 2024
92 checks passed
@bassrock bassrock deleted the fix/test-timers branch April 17, 2024 17:39
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

2 participants