Skip to content
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

Merged
merged 15 commits into from
Jan 24, 2018
Merged

Conversation

jonathan-stone
Copy link
Contributor

@jonathan-stone jonathan-stone commented Jan 24, 2018

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 the website 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.
jest-docs-screenshot

Copy link
Member

@SimenB SimenB left a 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-io
Copy link

Codecov Report

Merging #5383 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4585c73...9f4b441. Read the comment docs.

Copy link
Member

@SimenB SimenB left a 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!

@cpojer cpojer merged commit c243f67 into jestjs:master Jan 24, 2018
@cpojer
Copy link
Member

cpojer commented Jan 24, 2018

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 :)

@nidkil
Copy link

nidkil commented Nov 22, 2018

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.

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants