-
Notifications
You must be signed in to change notification settings - Fork 108
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
Allow configuring if lolex should return DOM or node timers #157
Conversation
This won't be enough for Jest's use case as for instance |
Interesting, I'm still leaning towards exposing the detection outside as configuration rather than accepting a global. I figured jest wouldn't be interested in things like whether or not |
Jest cares that it is shimmed at all, which it won't be without having lolex do it's detections either on if I suppose we could send the whitelist ourselves, but being able to say to Lolex "fake the timer functions on this passed in object" is a much nicer API |
@SimenB what about passing If you want hrtime you can also pass |
That might work, yeah. Same with I can apply these changes locally and see if it's enough for our use case 🙂 |
@SimenB right, but not with whether or not timers should or shouldn't return objects - which requires this PR. Would you be OK with that? I'm still willing to allow passing target more "aggressively" but I'm not really sure that's particularly good API behavior and this lets us do things explicitly. |
Doesn't work to pass any old string to
It's also impossible to fake |
Any thoughts on how to proceed with the issues @SimenB mentions? Is that a separate issue? |
Any news here? We're gearing up for Jest 23, and switching will probably be pretty breaking, so I'd love to be able to include Lolex in that release 🙏 I'm happy to put together a PR if we can figure out the correct API. The issue boils down to the fact that |
To be honest I'm not really 100% sure what a solution would be - so a PR would be great :) |
Fixes sinonjs#146 Closes sinonjs#157
@benjamingr cool, opened up #164 |
Thanks, let's continue the discussion there, I'm +1 on landing the changes in time for the next jest major |
Fixes sinonjs#146 Closes sinonjs#157
Fixes sinonjs#146 Closes sinonjs#157
Fixes (possibly) #146
CC @SimenB - let me know if this addresses your environment configuration issue with
global
or if a more general workaround (passing the library) is still required - this just felt less flakey to me.CC @fatso83