Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Fix
nock
compatibility with fake timers (#24805)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** The `nock` library is not compatible with the fake timers we use in unit tests because it uses the Node.js `timers` API. This API is not mocked correctly by the version of Jest we are using. Jest uses `@sinon/fake-timers` internally, which didn't support mocking the Node.js `timers` API until v11.0.0 (see sinonjs/fake-timers#467) This package is updated in Jest as part of the v30 release, which is currently under development. To workaround this problem in the meantime, the `nock` package has been updated and patched to use global timers rather than the `timers` API. Global timers are mocked correctly. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24805?quickstart=1) ## **Related issues** This was required for some unit tests that I will be submitting in a different PR, intended for #24503 ## **Manual testing steps** N/A ## **Screenshots/Recordings** N/A ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
- Loading branch information