-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Document class mocks #5383
Document class mocks #5383
Conversation
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.
Thanks for the PR! I'll read through it in a bit, but could you first run yarn lint:md
and fix the lint issues reported by CI?
/home/circleci/jest/docs/Es6ClassMocks.md
133:5 error 'mockPlaySoundFile' is never reassigned. Use 'const' instead prefer-const
244:5 error 'mockPlaySoundFile' is never reassigned. Use 'const' instead prefer-const
286:5 error 'mockPlaySoundFile' is never reassigned. Use 'const' instead prefer-const
Codecov Report
@@ Coverage Diff @@
## master #5383 +/- ##
=======================================
Coverage 61.32% 61.32%
=======================================
Files 205 205
Lines 6925 6925
Branches 3 3
=======================================
Hits 4247 4247
Misses 2677 2677
Partials 1 1 Continue to review full report at Codecov.
|
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.
This looks great! Thank you so much for taking the time to write it!
Thanks so much for sending a great guide to our documentation, this is always appreciated. We are looking forward to many more PRs from you to improve Jest's documentation :) |
For anyone reading this comment, I have setup a GitHub repository to test mocking modules and classes. It is based on the principles described in the document, but it covers both default and named exports. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This is my first PR. Feedback and suggestions are very welcome!
Summary
Documents in detail how to mock an ES6 class. Without this guide, it's hard to find the docs that exist for mocking an ES6 class, and also there is no explanation of how it works.
Resolves issue #5023
Test plan
ran
yarn start
in thewebsite
directory.Browsed to localhost:3000 using Firefox and Chrome
Ensured that new guide "ES6 Class Mocks" appears in the sidebar.
Ensured that clicking that sidebar link loads the new guide.
Tested all links in the content, which are links to other pages of the jest docs.