-
Notifications
You must be signed in to change notification settings - Fork 107
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
Dates created before useFakeTimers aren't seen as instanceof Date anymore #504
Comments
While this is a difference, I am not sure this is a bug or something we should fix up. The change was published as a breaking change, and usually you would install the fake timers before running the tests, run the tests, and then restore things. This would be an issue if you create data used in the tests before installing fake timers, and I am not sure if that's something that is more important to support than supporting instanceof checks on subclasses, which seems like a more real use case to support. Thoughts? |
also, in some cases, we may have well-defined dates that are global const. (therefore, created before FakeTimer takes action) We may also need to test that a variant value is of type Date at some point and one of those well-defined date could surface. ̀ |
I did not think it was possible to do anything about this, but Ben and the symbols of ES2015 came to the rescue. You want to test that my proposed fix works for you? #505 I still regard using |
Try the latest 19.0.2 version of Sinon. It should have the fix. |
Awesome solution , thanks, |
The test was beautiful, but was already covered: I only linked to the specific commit above that had the fix and the test was in a previous commit. You can see it here: ae0a266#diff-5a5796b4730f7629082606dc9407d4b8a084ab5ec38803e6141743b4bbb9f7efR3373 |
What did you expect to happen?
Date object that have been created before fakeTimer takes actions should still be instanceof Date, as it used to be in previous versions
What actually happens
How to reproduce
npm install sinon@19
The text was updated successfully, but these errors were encountered: