Add example to jest.requireActual#8482
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
SimenB
left a comment
There was a problem hiding this comment.
Thanks! Could you add this to the versioned docs as well?
Also to the examples in the typing: https://github.com/facebook/jest/blob/74f6faf2c87e8afaf56486378590e52c0089ef5a/packages/jest-environment/src/index.ts#L137-L141
|
@simen I've updated the version docs but I didn't understand how to update the example in the typing :x |
You can see how an example can be added to tsdoc here: https://github.com/sindresorhus/execa/blob/5766371212faa242f0070e9db91b72c6a3414580/index.d.ts#L299-L331 |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #8482 +/- ##
=======================================
Coverage 62.25% 62.25%
=======================================
Files 266 266
Lines 10746 10746
Branches 2625 2626 +1
=======================================
Hits 6690 6690
Misses 3471 3471
Partials 585 585Continue to review full report at Codecov.
|
|
@SimenB done, can you confirm? |
|
Thanks! |
|
Great, now how can I know when will it be published to the website? |
|
When https://circleci.com/gh/facebook/jest/64295 completes |
| ```js | ||
| jest.mock('../myModule', () => { | ||
| // Require the original module to not be mocked... | ||
| const originalModule = jest.requireActual(moduleName); |
There was a problem hiding this comment.
What is moduleName? Is it '../myModule'? Is it 'myModule'? Should be clarified.
|
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. |

Summary
I've spent 1 hour looking how to proper use
jest.requireActualuntil I found this comment: #936 (comment)I think it's too good to not be in the docs.
Test plan
Was just a quick change on the

.mdfile. This is how it looks now: