MetaMask / MetaMask/metamask-mobile
Use built-in types from Jest v29
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### What is this about?
Jest mocks accept generic type parameters that default to “any” if unspecified.
We don’t typically set these type parameters, meaning that most of our Jest mocks are untyped. Unfortunately with the `@types/jest` types we use today, we can set these parameters but it’s quite verbose
Jest v29 comes with improved built-in types, if you import globals from `@jest/globals`
See the info section at the top of this article for example: https://jestjs.io/docs/api
### Scenario
_No response_
### Design
_No response_
### Technical Details
- Replace the use of @types/jest with the built-in types from Jest
### Threat Modeling Framework
_No response_
### Acceptance Criteria
- Instead of having to mock the inputs and outputs of mock jest functions, we should be able to apply something like typeof FUNCTION
### Stakeholder review needed before the work gets merged
- [ ] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)
### References
_No response_
Contributor guide
Research direction
No files or tests are named. Start by locating the @types/jest dependency, Jest configuration, and existing mock imports, then review the Jest v29 @jest/globals guidance. Done means the repository uses Jest’s built-in types and mock inputs and outputs can use function types such as typeof FUNCTION without verbose generic annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100