Skip to content

Conversation

@vkarpov15
Copy link
Collaborator

Fix #14949

Summary

In our jest docs https://mongoosejs.com/docs/jest.html we recommend importing mongoose before calling useFakeTimers(), which gives us a way to work around #14949: ensure we get the Node built in Date class before useFakeTimers clobbers it. Works well with our claim that importing mongoose before useFakeTimers is "Fine for basic cases"

Examples

@vkarpov15 vkarpov15 added this to the 8.19.2 milestone Oct 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Snapshots the native Date constructor in connection.js to avoid Jest useFakeTimers() and similar timer mocks interfering with the stale heartbeat check.

  • Snapshot Date from the global object at module load.
  • Add a comment explaining the intent.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

vkarpov15 and others added 2 commits October 19, 2025 17:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@vkarpov15 vkarpov15 merged commit 104af11 into master Oct 20, 2025
74 checks passed
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-14949 branch October 20, 2025 17:00
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.

v8.7.1 transaction freeze

3 participants