-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Hi,
First off, thanks for this. It helped us be able to test some code with date_fns that would have been a nightmare otherwise.
The problem:
If you have UI tests running in node then you have a window object and a global. The code at:
Lines 265 to 272 in 780f8c2
| function register(new_timezone, glob) { | |
| if (!glob) { | |
| if (typeof window !== 'undefined') { | |
| glob = window; | |
| } else { | |
| glob = global; | |
| } | |
| } |
...assumes one or the other but not both.
As a workaround I'm doing:
timezoneMock.register(timezone);
global.Date = window.Date;
/// ...tests
timezoneMock.unregister();
global.Date = window.Date;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels