Replies: 2 comments
-
The docs discuss mocking modules: https://storybook.js.org/docs/writing-stories/mocking-data-and-modules/mocking-modules There is an example specifically for the global |
Beta Was this translation helpful? Give feedback.
0 replies
-
https://storybook.js.org/addons/storybook-addon-vite-mock this is more simple |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I am using vite, msw and storybook. Inside my application there are multiple regiions which rely on some sort of date (today or now). These dates are mostly getting fetched by moment or the default Date api. Now I am trying to basically globally mock these functions.
e.g.
Date.now()
moment()
moment().format()
Is there an easy way to do that?
I saw that I could basically somehow set the global time in the process, while this might work for this case other cases where I might want to mock anything else I am still at a loss.
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions