-
Notifications
You must be signed in to change notification settings - Fork 2
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
Mocking with Jest: Spying on Functions and Changing their Implementation #334
Comments
Thank you for writing this up. I had the hardest time figuring out how to use Jest's mocking features. Your article helped me understand how mocks and spies are supposed to be used which then led me to figure out that I did not need to use manual mocks because spies worked sufficiently well. I went through your article in great detail and wanted to share some issues I ran in to, in case it can help the next person reading your article:
does not have any accompanying code that specifies a
Sorry, I might have just missed some points and the above might not actually be typo's. Sorry in advance for my mistake. |
Thank you so much for you generous feedback! I updated my posts based on what you said 🚀 hopefully I covered everything that you had trouble with, and I'm so happy my posts helped you understand these features! |
This is a fantastic introduction to Jest's mocking features, especially for beginners intimidated by the concept. Your breakdown of mock functions, spying, and practical examples makes it approachable and engaging. I love how you tied the "meaning of life" theme into testing—humor always helps with learning! Mocking truly is a game-changer for robust, insightful tests. 🚀 Regards, |
Thank you very much! It's an old couple of posts that are still getting a lot of attention, I hope to make a series of Vitest posts one day. Mocking indeed changed my testing game as well! 💪 It's kind of underdocumented in Jest, that's why I wrote these posts. |
Mocking with Jest: Spying on Functions and Changing their Implementation
Using Jest to record calls of particular methods and even change their implementation.
https://silvenon.com/blog/mocking-with-jest/functions
The text was updated successfully, but these errors were encountered: