-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Correctly mock date.constructor #28
Conversation
Hi @hustcc, here is a bug fix to have this library continue to work with date-fns. We use this library and hope that we can release this fix for it soon. |
Can help to change travis to github action, like: https://github.com/hustcc/jest-random-mock/blob/main/.github/workflows/build.yml
|
That sounds like outside of the scope of this bugfix contribution. Maybe raise it as issues in the repo if it's work that requires contributors. |
@hustcc is this good to merge/release? |
let me run the case locally first. |
Pull Request Test Coverage Report for Build 8451584168Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
[email protected] released. |
What problem is this PR solving?
Currently, if you call
.constructor()
on an instance of a mocked date, you do not call the mock constructor. This change updates the constructor function on the mocked date to point to the mock date constructor.Why is this necessary?
date-fns v3 calls the constructor in this way, meaning that in order to be compatible with date-fns v3, this fix will need to be in place.