Skip to content

Conversation

@cryptodev-2s
Copy link
Contributor

Explanation

Replace sinon with Jest timers and mocks

  • Remove sinon and @types/sinon from 21 packages
  • Replace sinon.useFakeTimers() with jest.useFakeTimers()
  • Replace sinon.stub() with jest.fn() or jest.spyOn()
  • Replace sinon.spy() with jest.fn()
  • Replace sinon.restore() with jest.restoreAllMocks()
  • Update advanceTime helper to use jest.advanceTimersByTime()
  • Convert sinon assertion patterns to Jest equivalents:
    • .callCount → toHaveBeenCalledTimes()
    • .called → toHaveBeenCalled()
    • .calledWith() → toHaveBeenCalledWith()
    • .firstCall.args → .mock.calls[0]
    • .getCall(n).args → .mock.calls[n]

References

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 communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@cryptodev-2s cryptodev-2s force-pushed the refactor/replace-sinon-with-jest-timers branch 8 times, most recently from 83710f5 to e3ca2e6 Compare January 30, 2026 20:32
Remove sinon from devDependencies in packages where it was declared
but not actually used:
- app-metadata-controller
- approval-controller
- core-backend
- selected-network-controller
@cryptodev-2s cryptodev-2s force-pushed the refactor/replace-sinon-with-jest-timers branch 3 times, most recently from fe3514d to 2069bf0 Compare January 30, 2026 23:03
Migrate all test files from sinon fake timers to Jest fake timers
and manual time control pattern for async test compatibility.
@cryptodev-2s cryptodev-2s force-pushed the refactor/replace-sinon-with-jest-timers branch from 2069bf0 to c696592 Compare January 30, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants