2023-04-12 12:47:27 +03:00
|
|
|
/*
|
2024-09-06 17:44:31 +03:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2023-04-12 12:47:27 +03:00
|
|
|
Copyright 2023 The Matrix.org Foundation C.I.C.
|
|
|
|
|
2024-09-06 17:44:31 +03:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
|
|
|
Please see LICENSE files in the repository root for full details.
|
2023-04-12 12:47:27 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
import { env } from "process";
|
|
|
|
|
|
|
|
import type { Config } from "jest";
|
|
|
|
|
|
|
|
const config: Config = {
|
|
|
|
testEnvironment: "jsdom",
|
|
|
|
testEnvironmentOptions: {
|
|
|
|
url: "http://localhost/",
|
|
|
|
},
|
|
|
|
testMatch: ["<rootDir>/test/**/*-test.[tj]s?(x)"],
|
|
|
|
setupFiles: ["jest-canvas-mock"],
|
2023-09-26 14:28:31 +03:00
|
|
|
setupFilesAfterEnv: ["<rootDir>/node_modules/matrix-react-sdk/test/setupTests.ts"],
|
2023-04-12 12:47:27 +03:00
|
|
|
moduleNameMapper: {
|
|
|
|
"\\.(css|scss|pcss)$": "<rootDir>/__mocks__/cssMock.js",
|
|
|
|
"\\.(gif|png|ttf|woff2)$": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/imageMock.js",
|
|
|
|
"\\.svg$": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/svg.js",
|
|
|
|
"\\$webapp/i18n/languages.json": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/languages.json",
|
|
|
|
"^react$": "<rootDir>/node_modules/react",
|
|
|
|
"^react-dom$": "<rootDir>/node_modules/react-dom",
|
|
|
|
"^matrix-js-sdk$": "<rootDir>/node_modules/matrix-js-sdk/src",
|
|
|
|
"^matrix-react-sdk$": "<rootDir>/node_modules/matrix-react-sdk/src",
|
|
|
|
"decoderWorker\\.min\\.js": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/empty.js",
|
|
|
|
"decoderWorker\\.min\\.wasm": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/empty.js",
|
|
|
|
"waveWorker\\.min\\.js": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/empty.js",
|
|
|
|
"context-filter-polyfill": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/empty.js",
|
|
|
|
"FontManager.ts": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/FontManager.js",
|
2023-11-14 16:02:40 +03:00
|
|
|
"workers/(.+)Factory": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/workerFactoryMock.js",
|
2023-04-12 12:47:27 +03:00
|
|
|
"^!!raw-loader!.*": "jest-raw-loader",
|
2023-11-14 16:02:40 +03:00
|
|
|
"recorderWorkletFactory": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/empty.js",
|
2023-09-05 19:17:25 +03:00
|
|
|
"^fetch-mock$": "<rootDir>/node_modules/fetch-mock",
|
2023-04-12 12:47:27 +03:00
|
|
|
},
|
|
|
|
transformIgnorePatterns: ["/node_modules/(?!matrix-js-sdk).+$", "/node_modules/(?!matrix-react-sdk).+$"],
|
|
|
|
coverageReporters: ["text-summary", "lcov"],
|
|
|
|
testResultsProcessor: "@casualbot/jest-sonar-reporter",
|
|
|
|
};
|
|
|
|
|
|
|
|
// if we're running under GHA, enable the GHA reporter
|
|
|
|
if (env["GITHUB_ACTIONS"] !== undefined) {
|
|
|
|
config.reporters = [["github-actions", { silent: false }], "summary"];
|
|
|
|
}
|
|
|
|
|
|
|
|
export default config;
|