Skip to content

Switch from Jest to Vitest#5131

Merged
t3chguy merged 31 commits intodevelopfrom
t3chguy/vitest
Jan 15, 2026
Merged

Switch from Jest to Vitest#5131
t3chguy merged 31 commits intodevelopfrom
t3chguy/vitest

Conversation

@t3chguy
Copy link
Member

@t3chguy t3chguy commented Jan 9, 2026

Depends on #5136

Fairly simple transition:

  • @fetch-mock/jest -> @fetch-mock/vitest
  • jest -> vi mostly

Some smaller tweaks which should be obvious

Tests run much faster locally with significantly less memory pressure, in CI they go from about 3m -> 2m

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This test failed when ran individually, same as after the clearAllMocks call

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
…ny other way

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
…ch-mock & fix typo

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@t3chguy t3chguy requested review from dbkr and removed request for a team January 13, 2026 12:29
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this is not supposed to be the only change?Never mind, I'm being confused by github's UI where it only shows one file at a time if there are too many.

@t3chguy
Copy link
Member Author

t3chguy commented Jan 13, 2026

Presumably this is not supposed to be the only change?

Hm?

image

@t3chguy t3chguy requested a review from dbkr January 13, 2026 14:08
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise lgtm - phew, good to get this done!

vi.mocked(client.http.authedRequest).mockImplementation(function () {
return new Promise(() => {});
});
client.stopClient();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to do this or does vitest make it unnecessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on the side of the test file, the thread gets discarded between tests but a huge test file may benefit from it. Unfortunately any unhandled exceptions (such as those from a fetch being aborted) can upset the test during cleanup.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

@andybalaam andybalaam requested review from andybalaam and removed request for kaylendog and richvdh January 13, 2026 14:47
Base automatically changed from t3chguy/fetch-mock to develop January 14, 2026 13:08
…chguy/vitest

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

# Conflicts:
#	knip.ts
#	package.json
#	spec/integ/crypto/cross-signing.spec.ts
#	spec/integ/crypto/crypto.spec.ts
#	spec/integ/crypto/device-dehydration.spec.ts
#	spec/integ/crypto/history-sharing.spec.ts
#	spec/integ/crypto/megolm-backup.spec.ts
#	spec/integ/crypto/olm-utils.ts
#	spec/integ/crypto/rust-crypto.spec.ts
#	spec/integ/crypto/state-events.spec.ts
#	spec/integ/crypto/to-device-messages.spec.ts
#	spec/integ/crypto/verification.spec.ts
#	spec/integ/matrix-client-syncing-errors.spec.ts
#	spec/integ/rendezvous/MSC4108SignInWithQR.spec.ts
#	spec/integ/sliding-sync-sdk.spec.ts
#	spec/setupTests.ts
#	spec/test-utils/AccountDataAccumulator.ts
#	spec/test-utils/E2EKeyReceiver.ts
#	spec/test-utils/E2EKeyResponder.ts
#	spec/test-utils/E2EOTKClaimResponder.ts
#	spec/test-utils/SyncResponder.ts
#	spec/test-utils/mockEndpoints.ts
#	spec/unit/embedded.spec.ts
#	spec/unit/event-timeline-set.spec.ts
#	spec/unit/http-api/fetch.spec.ts
#	spec/unit/http-api/utils.spec.ts
#	spec/unit/login.spec.ts
#	spec/unit/matrix-client.spec.ts
#	spec/unit/matrixrtc/CallMembership.spec.ts
#	spec/unit/matrixrtc/MatrixRTCSession.spec.ts
#	spec/unit/matrixrtc/MembershipManager.spec.ts
#	spec/unit/matrixrtc/mocks.ts
#	spec/unit/oidc/authorize.spec.ts
#	spec/unit/oidc/register.spec.ts
#	spec/unit/oidc/tokenRefresher.spec.ts
#	spec/unit/rendezvous/MSC4108RendezvousSession.spec.ts
#	spec/unit/room-hierarchy.spec.ts
#	spec/unit/room-member.spec.ts
#	spec/unit/room.spec.ts
#	spec/unit/rust-crypto/KeyClaimManager.spec.ts
#	spec/unit/rust-crypto/OutgoingRequestProcessor.spec.ts
#	spec/unit/rust-crypto/PerSessionKeyBackupDownloader.spec.ts
#	spec/unit/rust-crypto/backup.spec.ts
#	spec/unit/rust-crypto/rust-crypto.spec.ts
#	spec/unit/secret-storage.spec.ts
#	spec/unit/webrtc/groupCall.spec.ts
#	yarn.lock
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Copy link
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at the voip part. Thanks for going through that 🙌

@t3chguy t3chguy added this pull request to the merge queue Jan 15, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 15, 2026
@t3chguy t3chguy added this pull request to the merge queue Jan 15, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 15, 2026
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@t3chguy t3chguy enabled auto-merge January 15, 2026 11:14
@t3chguy t3chguy added this pull request to the merge queue Jan 15, 2026
Merged via the queue into develop with commit 899cdb0 Jan 15, 2026
32 checks passed
@t3chguy t3chguy deleted the t3chguy/vitest branch January 15, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Task Tasks for the team like planning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants