-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add restoreMocks config to fix #3580 #5327
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5327 +/- ##
==========================================
- Coverage 61.25% 61.21% -0.04%
==========================================
Files 205 205
Lines 6896 6900 +4
Branches 3 3
==========================================
Hits 4224 4224
- Misses 2671 2675 +4
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.
See inline comments. Also, please update the changelog
test('first test', () => { | ||
jest.spyOn(localClass, 'test').mockImplementation(() => 'ABCD'); | ||
expect(localClass.test()).toEqual('ABCD'); | ||
expect(localClass.test.mock.calls.length).toBe(1); |
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.
.toHaveBeenCalledTimes(1)
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.
Same with the others
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.
Ah, yes. I left that the way it was in the tests for resetMocks. I wasn't sure if it was using that older style for a specific reason or not. Fixed.
As for the changelog, would this be correct? The changes touch jest-cli, jest-config, jest-jasmine2, etc. so I'm not sure which one to place in the beginning of the line. I went with jest-config since it's more related to the config.
* `[jest-config]` Add restoreMocks config option.
([#5327](https://github.com/facebook/jest/pull/5327))
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
Added a restoreMocks option to the Jest configuration as requested in #3580.
Test plan
Integration tests for this configuration option are included.