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");
|
|
|
|
|
|
|
|
module.exports = {
|
2023-01-11 15:01:02 +01:00
|
|
|
reporters: ["default", "jest-junit"],
|
|
|
|
|
2022-03-28 16:00:42 +02:00
|
|
|
collectCoverage: true,
|
|
|
|
coverageReporters: ["html", "lcov"],
|
|
|
|
coverageDirectory: "coverage",
|
|
|
|
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",
|
2022-06-14 17:10:53 +02:00
|
|
|
|
|
|
|
"<rootDir>/libs/angular/jest.config.js",
|
|
|
|
"<rootDir>/libs/common/jest.config.js",
|
2022-08-08 18:21:46 +02:00
|
|
|
"<rootDir>/libs/components/jest.config.js",
|
2023-03-23 11:43:27 +01:00
|
|
|
"<rootDir>/libs/importer/jest.config.js",
|
2022-06-14 17:10:53 +02:00
|
|
|
"<rootDir>/libs/node/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-09-08 00:05:30 +02:00
|
|
|
globals: {
|
|
|
|
"ts-jest": {
|
|
|
|
// Further workaround for memory leak, recommended here:
|
|
|
|
// https://github.com/kulshekhar/ts-jest/issues/1967#issuecomment-697494014
|
|
|
|
// Makes tests run faster and reduces size/rate of leak, but loses typechecking on test code
|
|
|
|
// See https://bitwarden.atlassian.net/browse/EC-497 for more info
|
|
|
|
isolatedModules: true,
|
|
|
|
},
|
|
|
|
},
|
2022-03-28 16:00:42 +02:00
|
|
|
};
|