Closed eakl closed 3 months ago
That's because lru-cache
uses performance.now(), not Date.now(). Maybe check out clock-mock, which I use to test lru-cache myself.
It works with mock-clock
but not with vitest (even after adding support to performance
and passing tests successfully on performance.now()
). Thanks @isaacs
Using vitest, I manage to mock Date.now
But it has no effect on lru-cache TTL. Vitest controlled timers doesn't seem to affect LRU timer.