mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
* Add missing libs to jest.config.js Added 15 missing libraries to the jest projects array: - libs/assets - libs/client-type - libs/core-test-utils - libs/dirt/card - libs/guid - libs/logging - libs/messaging-internal - libs/messaging - libs/serialization - libs/state-test-utils - libs/state - libs/storage-core - libs/storage-test-utils - libs/tools/export/vault-export/vault-export-ui - libs/user-core This ensures all existing libraries with jest.config.js files are included in CI test runs. * Update basic-lib generator to add new libs to jest.config.js - Added updateJestConfig function that automatically adds new libraries to jest.config.js - Function finds the appropriate alphabetical position for the new library - Added comprehensive tests for the new functionality - Ensures new libraries are included in CI test runs from creation This prevents the issue where new libraries are created but their tests are not run in CI because they are missing from the jest configuration. * Fix import statements in state-definitions and deserialization-helpers tests - Fixed ClientLocations import in state-definitions.spec.ts to use @bitwarden/storage-core instead of relative import - Simplified deserialization-helpers.spec.ts import to use library root @bitwarden/serialization
69 lines
2.9 KiB
JavaScript
69 lines
2.9 KiB
JavaScript
const { pathsToModuleNameMapper } = require("ts-jest");
|
|
|
|
const { compilerOptions } = require("./tsconfig.base");
|
|
|
|
/** @type {import('jest').Config} */
|
|
module.exports = {
|
|
reporters: ["default", "jest-junit"],
|
|
|
|
collectCoverage: true,
|
|
// Ensure we collect coverage from files without tests
|
|
collectCoverageFrom: ["src/**/*.ts"],
|
|
coverageReporters: ["html", "lcov"],
|
|
coverageDirectory: "coverage",
|
|
|
|
moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, {
|
|
prefix: "<rootDir>/",
|
|
}),
|
|
projects: [
|
|
"<rootDir>/apps/browser/jest.config.js",
|
|
"<rootDir>/apps/cli/jest.config.js",
|
|
"<rootDir>/apps/desktop/jest.config.js",
|
|
"<rootDir>/apps/web/jest.config.js",
|
|
"<rootDir>/bitwarden_license/bit-web/jest.config.js",
|
|
"<rootDir>/bitwarden_license/bit-cli/jest.config.js",
|
|
"<rootDir>/bitwarden_license/bit-common/jest.config.js",
|
|
|
|
"<rootDir>/libs/admin-console/jest.config.js",
|
|
"<rootDir>/libs/angular/jest.config.js",
|
|
"<rootDir>/libs/assets/jest.config.js",
|
|
"<rootDir>/libs/auth/jest.config.js",
|
|
"<rootDir>/libs/billing/jest.config.js",
|
|
"<rootDir>/libs/client-type/jest.config.js",
|
|
"<rootDir>/libs/common/jest.config.js",
|
|
"<rootDir>/libs/components/jest.config.js",
|
|
"<rootDir>/libs/core-test-utils/jest.config.js",
|
|
"<rootDir>/libs/dirt/card/jest.config.js",
|
|
"<rootDir>/libs/eslint/jest.config.js",
|
|
"<rootDir>/libs/guid/jest.config.js",
|
|
"<rootDir>/libs/importer/jest.config.js",
|
|
"<rootDir>/libs/key-management/jest.config.js",
|
|
"<rootDir>/libs/key-management-ui/jest.config.js",
|
|
"<rootDir>/libs/logging/jest.config.js",
|
|
"<rootDir>/libs/messaging-internal/jest.config.js",
|
|
"<rootDir>/libs/messaging/jest.config.js",
|
|
"<rootDir>/libs/node/jest.config.js",
|
|
"<rootDir>/libs/platform/jest.config.js",
|
|
"<rootDir>/libs/serialization/jest.config.js",
|
|
"<rootDir>/libs/state-test-utils/jest.config.js",
|
|
"<rootDir>/libs/state/jest.config.js",
|
|
"<rootDir>/libs/storage-core/jest.config.js",
|
|
"<rootDir>/libs/storage-test-utils/jest.config.js",
|
|
"<rootDir>/libs/tools/export/vault-export/vault-export-core/jest.config.js",
|
|
"<rootDir>/libs/tools/export/vault-export/vault-export-ui/jest.config.js",
|
|
"<rootDir>/libs/tools/generator/core/jest.config.js",
|
|
"<rootDir>/libs/tools/generator/components/jest.config.js",
|
|
"<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",
|
|
"<rootDir>/libs/tools/send/send-ui/jest.config.js",
|
|
"<rootDir>/libs/user-core/jest.config.js",
|
|
"<rootDir>/libs/vault/jest.config.js",
|
|
],
|
|
|
|
// 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,
|
|
};
|