-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
feat: add dangerouslyRunInProduction flag to worker and server options #1791
Conversation
scr2em
commented
Oct 23, 2023
•
edited by kettanaito
Loading
edited by kettanaito
- Closes Throw when run in production #1703
@kettanaito this actually breaks the current tests, do we need to enable dangerouslyRunInProduction in the package tests ? |
invariant( | ||
!this.context.startOptions.dangerouslyRunInProduction && isProduction(), | ||
devUtils.formatMessage( | ||
'The flag dangerouslyRunInProduction is false but you are in a production environment', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think if we phrase this error a bit better? Perhaps something like this?
- Failed to call "setupWorker" in a production environment. Please make sure you enable API mocking conditionally so it doesn't leak to production.
Don't even mention the flag that controls it to emphasize the importance of this behavior. Still include a link to the docs about the flag for those who know what they are doing and want to suppress this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kettanaito let me know the link when you finish it
Updated the branch. Still need some time to review and document this. |
Hey, @scr2em 👋 Thanks for helping me with this. I will close this one for now. We've not had a single issue on my memory when someone has deployed MSW to prod by mistake. Sometimes, that's what people want, depending on what they are building. Let's leave it this pull request for reference. |