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.
|
SimenB
left a comment
There was a problem hiding this comment.
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.
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.