-
Notifications
You must be signed in to change notification settings - Fork 30
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
TypeError: Cannot read property 'now' of undefined in 1.1.0 #17
Comments
Moving the discussion from #12 I don't think this is a bug in the library, when you start mocking your globals, windows, etc, things might start breaking. Also, your mocking of date in Block.test.tsx could not work - since the code is breaking on the import, before you even get to your "mock" |
Hi, for lost googlers that struggled like me, I needed to initialize JSDOM this way server side so
For the details this manual initialization of JSDOM is needed to test components with Enzyme server side in Vulcan (a Meteor + Mocha + React setup with SSR). The As explained in #15 maybe it would nice to catch this error early on in |
I am using typescript with react-hooks-testing-library that uses this library. To get tests to run, I had to mock Date in my tests
declare global {
interface Window { Date: any; }
}
window.Date = Date;
And comment out the code in wait-for-expect starting at line 16:
var _ref = typeof window !== "undefined" ? window : global,
setTimeout = _ref.setTimeout,
now = _ref.Date.now;
Is this a bug?
The text was updated successfully, but these errors were encountered: