2022-05-09 18:25:17 +02:00
|
|
|
const { pathsToModuleNameMapper } = require("ts-jest");
|
2022-03-28 16:00:42 +02:00
|
|
|
|
|
|
|
const { compilerOptions } = require("./tsconfig");
|
|
|
|
|
2023-05-22 20:19:16 +02:00
|
|
|
/** @type {import('jest').Config} */
|
2022-03-28 16:00:42 +02:00
|
|
|
module.exports = {
|
2023-01-11 15:01:02 +01:00
|
|
|
reporters: ["default", "jest-junit"],
|
|
|
|
|
2022-03-28 16:00:42 +02:00
|
|
|
collectCoverage: true,
|
2024-02-20 16:18:04 +01:00
|
|
|
// Ensure we collect coverage from files without tests
|
|
|
|
collectCoverageFrom: ["src/**/*.ts"],
|
2022-03-28 16:00:42 +02:00
|
|
|
coverageReporters: ["html", "lcov"],
|
|
|
|
coverageDirectory: "coverage",
|
2023-05-22 20:19:16 +02:00
|
|
|
|
2022-03-28 16:00:42 +02:00
|
|
|
moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, {
|
|
|
|
prefix: "<rootDir>/",
|
|
|
|
}),
|
|
|
|
projects: [
|
2022-06-14 17:10:53 +02:00
|
|
|
"<rootDir>/apps/browser/jest.config.js",
|
|
|
|
"<rootDir>/apps/cli/jest.config.js",
|
2022-09-15 18:31:15 +02:00
|
|
|
"<rootDir>/apps/desktop/jest.config.js",
|
2022-08-11 03:35:08 +02:00
|
|
|
"<rootDir>/apps/web/jest.config.js",
|
2022-08-15 16:08:06 +02:00
|
|
|
"<rootDir>/bitwarden_license/bit-web/jest.config.js",
|
2024-05-15 16:09:24 +02:00
|
|
|
"<rootDir>/bitwarden_license/bit-cli/jest.config.js",
|
2024-05-20 12:18:23 +02:00
|
|
|
"<rootDir>/bitwarden_license/bit-common/jest.config.js",
|
2022-06-14 17:10:53 +02:00
|
|
|
|
2023-12-15 15:02:21 +01:00
|
|
|
"<rootDir>/libs/admin-console/jest.config.js",
|
2022-06-14 17:10:53 +02:00
|
|
|
"<rootDir>/libs/angular/jest.config.js",
|
2023-08-08 15:37:25 +02:00
|
|
|
"<rootDir>/libs/auth/jest.config.js",
|
2023-12-15 15:02:21 +01:00
|
|
|
"<rootDir>/libs/billing/jest.config.js",
|
2022-06-14 17:10:53 +02:00
|
|
|
"<rootDir>/libs/common/jest.config.js",
|
2022-08-08 18:21:46 +02:00
|
|
|
"<rootDir>/libs/components/jest.config.js",
|
2024-02-13 20:22:37 +01:00
|
|
|
"<rootDir>/libs/tools/export/vault-export/vault-export-core/jest.config.js",
|
2024-05-30 21:38:31 +02:00
|
|
|
"<rootDir>/libs/tools/generator/core/jest.config.js",
|
2024-08-28 15:26:17 +02:00
|
|
|
"<rootDir>/libs/tools/generator/components/jest.config.js",
|
2024-06-20 16:49:23 +02:00
|
|
|
"<rootDir>/libs/tools/generator/extensions/history/jest.config.js",
|
|
|
|
"<rootDir>/libs/tools/generator/extensions/legacy/jest.config.js",
|
|
|
|
"<rootDir>/libs/tools/generator/extensions/navigation/jest.config.js",
|
2024-07-19 21:17:52 +02:00
|
|
|
"<rootDir>/libs/tools/send/send-ui/jest.config.js",
|
2023-08-08 15:37:25 +02:00
|
|
|
"<rootDir>/libs/importer/jest.config.js",
|
2023-12-15 15:02:21 +01:00
|
|
|
"<rootDir>/libs/platform/jest.config.js",
|
2022-06-14 17:10:53 +02:00
|
|
|
"<rootDir>/libs/node/jest.config.js",
|
2023-08-22 16:02:48 +02:00
|
|
|
"<rootDir>/libs/vault/jest.config.js",
|
2024-11-05 17:03:43 +01:00
|
|
|
"<rootDir>/libs/key-management/jest.config.js",
|
2022-03-28 16:00:42 +02:00
|
|
|
],
|
2022-08-11 03:35:08 +02:00
|
|
|
|
|
|
|
// Workaround for a memory leak that crashes tests in CI:
|
|
|
|
// https://github.com/facebook/jest/issues/9430#issuecomment-1149882002
|
|
|
|
// Also anecdotally improves performance when run locally
|
|
|
|
maxWorkers: 3,
|
2022-03-28 16:00:42 +02:00
|
|
|
};
|