Closed chrisworfolksky closed 5 years ago
Thanks for opening an issue!
You can always get non mocked instances by creating a new realm and "stealing" date from there or getting a reference to Date before clock.install
var originalDate = Date;
clock.install();
new originalDate(); // correct
Thanks!
I am using
sinon.useFakeTimers
to mock the date for some unit tests. This is working fine. However, I've also got some debugging logs and I want to add a timestamp to each line. However, as I am using the clock, I get the mocked date in my timestamps, rather than the actual date.I don't want to call the
uninstall
method because I still want it installed for the rest of the test.One potential solution would be if we could call the original
Date
object manually, something like: