-
-
Notifications
You must be signed in to change notification settings - Fork 268
Enable resetMocks Jest configuration option
#4417
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jest has a configuration option `resetMocks`. Equivalent to calling `jest.resetAllMocks()` before each test, it helps to ensure that tests are run in isolation by removing fake implementations for each registered mock function, thereby resetting its state. This option is enabled by default for new Jest projects but has been disabled in this repo for a very long time. For some test suites, `jest.resetAllMocks()` (or some variant) has been added to a `beforeEach` or `afterEach` to simulate this option, but overall this is not the case, and some tests were written which assumed that mock functions were not being reset between tests. This commit enables the aforementioned configuration option, fixes tests that fail as a result of this, and removes manual calls to `jest.resetAllMocks()` (or the like).
0136db9 to
fed305e
Compare
kanthesha
previously approved these changes
Jun 14, 2024
Contributor
kanthesha
left a comment
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.
LGTM.
Mrtenz
previously approved these changes
Jun 14, 2024
Releases `queued-request-controller` methods array constructor param to callback constructor param update --------- Co-authored-by: Alex Donesky <adonesky@gmail.com>
## Explanation it seems we were inconsistent and forgot to correctly handle default exports and controller exports ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
## Explanation Releases `profile-sync-controller` and from `0.0.0` to `0.1.0` ## References N/A ## Changelog ### `@metamask/profile-sync-controller` - **ADDED**: Initial release of SDK; Authentication Controller; User Storage Controller. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
## Explanation This was removed as it was blocking publishing of profile sync controller. Adding here so it unblocks the next release for this controller: #4438 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
## Explanation Releases `notification-services-controller` from `0.0.0` to `0.1.0`. ## References N/A ## Changelog ### `@metamask/notification-services-controller` - **ADDED**: Initial Release of Notification Services Controller; Notification Services Push Controller. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
Cleans up / fixes some `SelectedNetworkController` specs Fixes: MetaMask/MetaMask-planning#2626 No consumer facing changes - [x] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate --------- Co-authored-by: Alex Donesky <adonesky@gmail.com>
## Explanation Please see MetaMask/MetaMask-planning#2668 ## References See: MetaMask/MetaMask-planning#2668 Unblocks: #4327 ## Changelog No user facing changes ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate --------- Co-authored-by: Jiexi Luan <jiexiluan@gmail.com> Co-authored-by: Derek Brans <dbrans@gmail.com>
## Explanation Met with @matthewwalsh0 who took the time to explain each status. ## References ## Changelog ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate
…lectedAddress (#4219) ## Explanation This PR updates the `selectedAccount` to `selectedAccountId` in the token controllers ## References Fixes MetaMask/accounts-planning#381 ## Changelog ### `@metamask/assets-controllers` - **BREAKING**: `TokenBalancesController` update `PreferencesConrtollerGetStateAction` to `AccountsControllerGetSelectedAccountAction` - **BREAKING**: `TokenDetectionController` change `selectedAddress` to `selectedAccountId` - **ADDED**: `TokenDetectionController` add `getAccountAction` - **BREAKING**: `TokenRatesController` change `selectedAddress` to `selectedAccountId` - **BREAKING**: `onPreferencesStateChange` arg removed and `getInternalAccount` and `onSelectedAccountChange` added in `TokenRatesController` - **ADDED**: `getAccountAction` added in`TokensController` - **BREAKING**: Changed `selectedAddress` to `selectedAccountId` and `PreferencesControllerStateChangeEvent` to `AccountsControllerSelectedEvmAccountChangeEvent` in the `TokensController` - **ADDED**: `getAccountAction` added in`TokensController` ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
Contributor
Author
|
Resolved conflicts. |
Gudahtt
reviewed
Jun 21, 2024
Gudahtt
approved these changes
Jun 24, 2024
Member
Gudahtt
left a comment
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.
LGTM!
FrederikBolding
approved these changes
Jun 24, 2024
3 tasks
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
Jest has a configuration option
resetMocks. Equivalent to callingjest.resetAllMocks()before each test, it helps to ensure that tests are run in isolation by removing fake implementations for each registered mock function, thereby resetting its state.This option is enabled by default for new Jest projects but has been disabled in this repo for a very long time. For some test suites,
jest.resetAllMocks()(or some variant) has been added to abeforeEachorafterEachto simulate this option, but overall this is not the case, and some tests were written which assumed that mock functions were not being reset between tests.This commit enables the aforementioned configuration option, fixes tests that fail as a result of this, and removes manual calls to
jest.resetAllMocks()(or the like).References
Fixes #745.
Changelog
(N/A)
Checklist