Files
ThreadNet-Web/apps/web/vitest.config.ts
T
2430e0ab8b Move some of the slowest tests from jest to vitest (#34277)
* 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

* Iterate based on copilot review

* Fix InviteDialog throttle

* Iterate

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix lockfile

* Iterate

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-22 13:18:04 +00:00

69 lines
2.3 KiB
TypeScript

/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { defineProject } from "vitest/config";
import svgr from "vite-plugin-svgr";
import { resolve } from "node:path";
export default defineProject({
resolve: {
alias: [
{ find: "test-utils-rtl", replacement: resolve(__dirname, "./test/test-utils/vitest-matrix-react") },
{ find: "test-utils", replacement: resolve(__dirname, "./test/test-utils") },
// Stub out workers as they do not play well under test
{
find: /.*workers\/(.+)Factory/,
replacement: resolve(__dirname, "./__mocks__/workerFactoryMock.js"),
},
{
find: /.*waveWorker\.min\.js$/,
replacement: resolve(__dirname, "./__mocks__/empty.js"),
},
{
find: /.*decoderWorker\.min\.js$/,
replacement: resolve(__dirname, "./__mocks__/empty.js"),
},
{
find: /.*decoderWorker\.min\.wasm$/,
replacement: resolve(__dirname, "./__mocks__/empty.js"),
},
// Stub this out as we lack AudioWorkletProcessor in the test env
{
find: "./recorderWorkletFactory",
replacement: resolve(__dirname, "./__mocks__/empty.js"),
},
// Stub out legacy modules so we don't need to build them first
{
find: "../modules.js",
replacement: resolve(__dirname, "./__mocks__/empty.js"),
},
],
},
test: {
include: ["src/**/*.test.{ts,tsx}"],
environment: "node",
pool: "threads",
globals: false,
setupFiles: ["src/test/setupTests.ts"],
environmentOptions: {
happyDOM: {
url: "http://localhost/",
},
},
snapshotSerializers: [resolve(__dirname, "./src/test/react-use-id-serializer.ts")],
},
plugins: [
svgr({
svgrOptions: {
ref: true,
svgProps: { "role": "presentation", "aria-hidden": "true" },
expandProps: "end",
},
}),
],
});