Migrate more tests to vitest (#34355)

* Remove doubled-up I18n Provider. ModalManager already provides this.

* Reconfigure svgr into a vite-friendly `?react` resource query

* Move InviteDialog test to vitest

* Move RoomHeader tests to Vitest

* Share serializer between Jest & Vitest

* Attempt to stabilise InviteDialog test

* Fix async leaks

* Migrate more tests to vitest

* Migrate MatrixChat test to vitest

* Deflake

* Iterate

* Iterate

* Iterate
This commit is contained in:
Michael Telatynski
2026-07-30 09:11:29 +00:00
committed by GitHub
parent 42253a7ae5
commit 27906ce6e7
18 changed files with 471 additions and 393 deletions
+14 -5
View File
@@ -5,7 +5,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import { vi, expect as viExpect, beforeAll as viBeforeAll, afterAll as viAfterAll } from "vitest";
import { vi } from "vitest";
import * as vitest from "vitest";
import { mocked as jestMocked } from "jest-mock";
export const isJest = typeof jest !== "undefined";
@@ -25,9 +26,17 @@ const adapter = {
const mocked = adapter.mocked;
export { adapter as vi, mocked };
const _expect = isJest ? (expect as unknown as typeof viExpect) : viExpect;
const _beforeAll = isJest ? (beforeAll as unknown as typeof viBeforeAll) : viBeforeAll;
const _afterAll = isJest ? (afterAll as unknown as typeof viAfterAll) : viAfterAll;
export { _expect as expect, _beforeAll as beforeAll, _afterAll as afterAll };
const _expect = isJest ? (expect as unknown as typeof vitest.expect) : vitest.expect;
const _beforeAll = isJest ? (beforeAll as unknown as typeof vitest.beforeAll) : vitest.beforeAll;
const _afterAll = isJest ? (afterAll as unknown as typeof vitest.afterAll) : vitest.afterAll;
const _beforeEach = isJest ? (beforeEach as unknown as typeof vitest.beforeEach) : vitest.beforeEach;
const _afterEach = isJest ? (afterEach as unknown as typeof vitest.afterEach) : vitest.afterEach;
export {
_expect as expect,
_beforeAll as beforeAll,
_afterAll as afterAll,
_beforeEach as beforeEach,
_afterEach as afterEach,
};
export { type Mocked, type MockedObject } from "vitest";