1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-11 00:31:45 +01:00
bitwarden-browser/jest.config.js
Andreas Coroiu d7c46bb3a5
[PM-16231] Improved SDK referencing (#12475)
* feat: implement Rc

* feat: use Rc in sdk service

* docs: add an example to `take()`

* fix: clarify function doc

* Add custom eslint rule package with enforced `using` rule (#13009)

* feat: add custom eslint rule

* feat: check for `UsingRequired` instead of hardcoding `Rc`

* chore: move package to libs

* wip: add tests. Tests work when run from same folder but not from root

* fix: add dependencies to renovate

* fix: add empty ts file to avoid typechecking throwing errors

* fix: tests not running from root

* chore: remove unecessary config

* fix: linting

* docs: add readme

* chore: add platform ownership

* chore: clean up comment

* Add support for flat config to "Improved sdk referencing" (#13054)

* WIP flat config for eslint

* Add rxjs

* Configure vscode to use flat config

* Fix some new linting errors

* Remove directory overrides of .eslintrc

* Remove explicit dependencies on typescript-eslint/ and @angular-eslint/

* Add missing rules

* Add rxjs recommended rules

* Add storybook and enabled rxjs-angular rule

* Add buildNoRestrictedImports helper

* Ignore platform import restrictions

* Remove unused ignores

* feat: migrate rules over to .mjs and flat config

* feat: implement support for .mjs tests

* chore: remove old package approach

* chore: update package-lock

* fix: add empty TS file to stop errors

* chore: clean up comments

---------

Co-authored-by: Hinton <hinton@users.noreply.github.com>

* fix: update CODEOWNERS to match folder name

* fix: renovate.json after merge

* fix: package.json, pin versions, sort order

* fix: update package-lock.json

---------

Co-authored-by: Hinton <hinton@users.noreply.github.com>
2025-02-03 15:09:25 +01:00

54 lines
2.1 KiB
JavaScript

const { pathsToModuleNameMapper } = require("ts-jest");
const { compilerOptions } = require("./tsconfig");
/** @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/auth/jest.config.js",
"<rootDir>/libs/billing/jest.config.js",
"<rootDir>/libs/common/jest.config.js",
"<rootDir>/libs/components/jest.config.js",
"<rootDir>/libs/eslint/jest.config.js",
"<rootDir>/libs/tools/export/vault-export/vault-export-core/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/importer/jest.config.js",
"<rootDir>/libs/platform/jest.config.js",
"<rootDir>/libs/node/jest.config.js",
"<rootDir>/libs/vault/jest.config.js",
"<rootDir>/libs/key-management/jest.config.js",
"<rootDir>/libs/key-management-ui/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,
};