From cb6217acc523bf73934a2e0b7c6e6a27fc2134af Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Tue, 7 Oct 2025 11:44:30 -0700 Subject: [PATCH] Use a shared jest config Add play.spec.ts as playwright test plaths. Also establishes .type.spec.ts as a specially ignored path everywhere. Finally, we no longer need the ast transformer since we don't use import.meta statements anymore. (this was also two years ago, it's possible this just works now). --- apps/cli/jest.config.js | 2 +- bitwarden_license/bit-cli/jest.config.js | 2 +- libs/assets/tsconfig.spec.json | 2 +- libs/client-type/tsconfig.spec.json | 2 +- libs/common/jest.config.js | 2 +- libs/core-test-utils/tsconfig.spec.json | 2 +- libs/eslint/jest.config.js | 1 - libs/guid/tsconfig.spec.json | 2 +- libs/importer/jest.config.js | 2 +- libs/logging/tsconfig.spec.json | 2 +- libs/messaging/tsconfig.spec.json | 2 +- libs/node/jest.config.js | 2 +- libs/nx-plugin/project.json | 2 +- .../files/tsconfig.spec.json__tmpl__ | 2 +- libs/nx-plugin/tsconfig.lib.json | 2 +- libs/nx-plugin/tsconfig.spec.json | 2 +- libs/pricing/tsconfig.spec.json | 2 +- libs/serialization/tsconfig.spec.json | 2 +- libs/shared/es2020-transformer.ts | 36 ------------------- libs/shared/jest.config.angular.js | 5 +-- .../{jest.config.ts.js => jest.config.js} | 9 +++-- libs/state-internal/tsconfig.spec.json | 2 +- libs/state-test-utils/tsconfig.spec.json | 2 +- libs/state/tsconfig.spec.json | 2 +- libs/storage-core/tsconfig.spec.json | 2 +- libs/storage-test-utils/tsconfig.spec.json | 2 +- .../vault-export-core/jest.config.js | 3 +- .../vault-export-ui/jest.config.js | 3 +- .../tools/generator/components/jest.config.js | 3 +- libs/tools/generator/core/jest.config.js | 3 +- .../extensions/history/jest.config.js | 3 +- .../extensions/legacy/jest.config.js | 3 +- .../extensions/navigation/jest.config.js | 3 +- libs/tools/send/send-ui/jest.config.js | 5 ++- libs/user-core/tsconfig.spec.json | 2 +- package-lock.json | 18 +++++----- package.json | 1 + 37 files changed, 55 insertions(+), 87 deletions(-) delete mode 100644 libs/shared/es2020-transformer.ts rename libs/shared/{jest.config.ts.js => jest.config.js} (74%) diff --git a/apps/cli/jest.config.js b/apps/cli/jest.config.js index c96395944b5..238d6156f0c 100644 --- a/apps/cli/jest.config.js +++ b/apps/cli/jest.config.js @@ -2,7 +2,7 @@ const { pathsToModuleNameMapper } = require("ts-jest"); const { compilerOptions } = require("../../tsconfig.base"); -const sharedConfig = require("../../libs/shared/jest.config.ts"); +const sharedConfig = require("../../libs/shared/jest.config"); /** @type {import('jest').Config} */ module.exports = { diff --git a/bitwarden_license/bit-cli/jest.config.js b/bitwarden_license/bit-cli/jest.config.js index 6a91ba706ed..3dd5fd67877 100644 --- a/bitwarden_license/bit-cli/jest.config.js +++ b/bitwarden_license/bit-cli/jest.config.js @@ -2,7 +2,7 @@ const { pathsToModuleNameMapper } = require("ts-jest"); const { compilerOptions } = require("../../tsconfig.base"); -const sharedConfig = require("../../libs/shared/jest.config.ts"); +const sharedConfig = require("../../libs/shared/jest.config"); /** @type {import('jest').Config} */ module.exports = { diff --git a/libs/assets/tsconfig.spec.json b/libs/assets/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/assets/tsconfig.spec.json +++ b/libs/assets/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/client-type/tsconfig.spec.json b/libs/client-type/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/client-type/tsconfig.spec.json +++ b/libs/client-type/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/common/jest.config.js b/libs/common/jest.config.js index a1e14ee62f8..e293969dd6c 100644 --- a/libs/common/jest.config.js +++ b/libs/common/jest.config.js @@ -2,7 +2,7 @@ const { pathsToModuleNameMapper } = require("ts-jest"); const { compilerOptions } = require("../../tsconfig.base"); -const sharedConfig = require("../shared/jest.config.ts"); +const sharedConfig = require("../shared/jest.config"); /** @type {import('jest').Config} */ module.exports = { diff --git a/libs/core-test-utils/tsconfig.spec.json b/libs/core-test-utils/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/core-test-utils/tsconfig.spec.json +++ b/libs/core-test-utils/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/eslint/jest.config.js b/libs/eslint/jest.config.js index 118e698bae5..1d17c15b00e 100644 --- a/libs/eslint/jest.config.js +++ b/libs/eslint/jest.config.js @@ -4,7 +4,6 @@ const sharedConfig = require("../../libs/shared/jest.config.angular"); module.exports = { ...sharedConfig, testEnvironment: "./fix-jsdom.ts", - testMatch: ["**/+(*.)+(spec).+(mjs)"], displayName: "libs/eslint tests", setupFilesAfterEnv: ["/test.setup.mjs"], }; diff --git a/libs/guid/tsconfig.spec.json b/libs/guid/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/guid/tsconfig.spec.json +++ b/libs/guid/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/importer/jest.config.js b/libs/importer/jest.config.js index 0d7db28409f..698a3e0f079 100644 --- a/libs/importer/jest.config.js +++ b/libs/importer/jest.config.js @@ -2,7 +2,7 @@ const { pathsToModuleNameMapper } = require("ts-jest"); const { compilerOptions } = require("../../tsconfig.base"); -const sharedConfig = require("../shared/jest.config.ts"); +const sharedConfig = require("../shared/jest.config"); /** @type {import('jest').Config} */ module.exports = { diff --git a/libs/logging/tsconfig.spec.json b/libs/logging/tsconfig.spec.json index a19b962c49a..fef1445e9fd 100644 --- a/libs/logging/tsconfig.spec.json +++ b/libs/logging/tsconfig.spec.json @@ -7,7 +7,7 @@ "types": ["jest", "node"] }, "include": [ - "jest.config.ts", + "jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts", diff --git a/libs/messaging/tsconfig.spec.json b/libs/messaging/tsconfig.spec.json index 2e5b192faff..8526e02248e 100644 --- a/libs/messaging/tsconfig.spec.json +++ b/libs/messaging/tsconfig.spec.json @@ -7,7 +7,7 @@ "types": ["jest", "node"] }, "include": [ - "jest.config.ts", + "jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts", diff --git a/libs/node/jest.config.js b/libs/node/jest.config.js index d765efcfa2c..d4f52e05282 100644 --- a/libs/node/jest.config.js +++ b/libs/node/jest.config.js @@ -2,7 +2,7 @@ const { pathsToModuleNameMapper } = require("ts-jest"); const { compilerOptions } = require("../../tsconfig.base"); -const sharedConfig = require("../shared/jest.config.ts"); +const sharedConfig = require("../shared/jest.config"); /** @type {import('jest').Config} */ module.exports = { diff --git a/libs/nx-plugin/project.json b/libs/nx-plugin/project.json index 1d4931e1674..a120ca3fc73 100644 --- a/libs/nx-plugin/project.json +++ b/libs/nx-plugin/project.json @@ -45,7 +45,7 @@ "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "libs/nx-plugin/jest.config.ts" + "jestConfig": "libs/nx-plugin/jest.config" } } } diff --git a/libs/nx-plugin/src/generators/files/tsconfig.spec.json__tmpl__ b/libs/nx-plugin/src/generators/files/tsconfig.spec.json__tmpl__ index c011a34d3d2..4e890d390d4 100644 --- a/libs/nx-plugin/src/generators/files/tsconfig.spec.json__tmpl__ +++ b/libs/nx-plugin/src/generators/files/tsconfig.spec.json__tmpl__ @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/nx-plugin/tsconfig.lib.json b/libs/nx-plugin/tsconfig.lib.json index 33eca2c2cdf..ca7c56a2ed6 100644 --- a/libs/nx-plugin/tsconfig.lib.json +++ b/libs/nx-plugin/tsconfig.lib.json @@ -6,5 +6,5 @@ "types": ["node"] }, "include": ["src/**/*.ts"], - "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] + "exclude": ["jest.config", "src/**/*.spec.ts", "src/**/*.test.ts"] } diff --git a/libs/nx-plugin/tsconfig.spec.json b/libs/nx-plugin/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/nx-plugin/tsconfig.spec.json +++ b/libs/nx-plugin/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/pricing/tsconfig.spec.json b/libs/pricing/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/pricing/tsconfig.spec.json +++ b/libs/pricing/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/serialization/tsconfig.spec.json b/libs/serialization/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/serialization/tsconfig.spec.json +++ b/libs/serialization/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/shared/es2020-transformer.ts b/libs/shared/es2020-transformer.ts deleted file mode 100644 index 3a26e1c0c2e..00000000000 --- a/libs/shared/es2020-transformer.ts +++ /dev/null @@ -1,36 +0,0 @@ -import * as ts from "typescript"; - -// Custom Typescript AST transformer for use with ts-jest / jest-preset-angular -// Removes specified ES2020 syntax from source code, as node does not support it yet -// Reference: https://kulshekhar.github.io/ts-jest/docs/getting-started/options/astTransformers -// Use this tool to understand how we identify and filter AST nodes: https://ts-ast-viewer.com/ - -/** - * Remember to increase the version whenever transformer's content is changed. This is to inform Jest to not reuse - * the previous cache which contains old transformer's content - */ -export const version = 1; -export const name = "bit-es2020-transformer"; - -// Returns true for 'import.meta' statements -const isImportMetaStatement = (node: ts.Node) => - ts.isPropertyAccessExpression(node) && - ts.isMetaProperty(node.expression) && - node.expression.keywordToken === ts.SyntaxKind.ImportKeyword; - -export const factory = function (/*opts?: Opts*/) { - function visitor(ctx: ts.TransformationContext, sf: ts.SourceFile) { - const visitor: ts.Visitor = (node: ts.Node): ts.VisitResult => { - if (isImportMetaStatement(node)) { - return null; - } - - // Continue searching child nodes - return ts.visitEachChild(node, visitor, ctx); - }; - return visitor; - } - return (ctx: ts.TransformationContext): ts.Transformer => { - return (sf: ts.SourceFile) => ts.visitNode(sf, visitor(ctx, sf)); - }; -}; diff --git a/libs/shared/jest.config.angular.js b/libs/shared/jest.config.angular.js index 6a9b52395f6..eb7a0ba5898 100644 --- a/libs/shared/jest.config.angular.js +++ b/libs/shared/jest.config.angular.js @@ -4,9 +4,6 @@ const { createCjsPreset } = require("jest-preset-angular/presets"); const presetConfig = createCjsPreset({ tsconfig: "/tsconfig.spec.json", - astTransformers: { - before: ["/../../libs/shared/es2020-transformer.ts"], - }, diagnostics: { ignoreCodes: ["TS151001"], }, @@ -16,10 +13,10 @@ const presetConfig = createCjsPreset({ module.exports = { ...presetConfig, testMatch: ["**/+(*.)+(spec).+(ts)"], - testPathIgnorePatterns: [ "/node_modules/", // default value ".*.type.spec.ts", // ignore type tests (which are checked at compile time and not run by jest) + ".*.play.spec.ts", // ignore playwright tests ], // Improves on-demand performance, for watches prefer 25%, overridable by setting --maxWorkers diff --git a/libs/shared/jest.config.ts.js b/libs/shared/jest.config.js similarity index 74% rename from libs/shared/jest.config.ts.js rename to libs/shared/jest.config.js index 04ab80859ba..8ff369c965e 100644 --- a/libs/shared/jest.config.ts.js +++ b/libs/shared/jest.config.js @@ -2,7 +2,13 @@ /** @type {import('jest').Config} */ module.exports = { + // Match all .spec.ts files, but not .play.spec.ts files, those are playwright tests testMatch: ["**/+(*.)+(spec).+(ts)"], + testPathIgnorePatterns: [ + "/node_modules/", // default value + ".*.type.spec.ts", // ignore type tests (which are checked at compile time and not run by jest) + ".*.play.spec.ts", // ignore playwright tests + ], // Workaround for a memory leak that crashes tests in CI: // https://github.com/facebook/jest/issues/9430#issuecomment-1149882002 @@ -20,9 +26,6 @@ module.exports = { // 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, - astTransformers: { - before: ["/../../libs/shared/es2020-transformer.ts"], - }, }, ], }, diff --git a/libs/state-internal/tsconfig.spec.json b/libs/state-internal/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/state-internal/tsconfig.spec.json +++ b/libs/state-internal/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/state-test-utils/tsconfig.spec.json b/libs/state-test-utils/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/state-test-utils/tsconfig.spec.json +++ b/libs/state-test-utils/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/state/tsconfig.spec.json b/libs/state/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/state/tsconfig.spec.json +++ b/libs/state/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/storage-core/tsconfig.spec.json b/libs/storage-core/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/storage-core/tsconfig.spec.json +++ b/libs/storage-core/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/storage-test-utils/tsconfig.spec.json b/libs/storage-test-utils/tsconfig.spec.json index 901c72378dd..2c39ee7a1e0 100644 --- a/libs/storage-test-utils/tsconfig.spec.json +++ b/libs/storage-test-utils/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/libs/tools/export/vault-export/vault-export-core/jest.config.js b/libs/tools/export/vault-export/vault-export-core/jest.config.js index 68c286de3d3..d28c110d2ad 100644 --- a/libs/tools/export/vault-export/vault-export-core/jest.config.js +++ b/libs/tools/export/vault-export/vault-export-core/jest.config.js @@ -1,10 +1,11 @@ const { pathsToModuleNameMapper } = require("ts-jest"); +const sharedConfig = require("../../../../shared/jest.config"); const { compilerOptions } = require("../../../../../tsconfig.base"); /** @type {import('jest').Config} */ module.exports = { - testMatch: ["**/+(*.)+(spec).+(ts)"], + ...sharedConfig, preset: "ts-jest", testEnvironment: "jsdom", moduleNameMapper: pathsToModuleNameMapper( diff --git a/libs/tools/export/vault-export/vault-export-ui/jest.config.js b/libs/tools/export/vault-export/vault-export-ui/jest.config.js index 066309a8bfc..2951848af17 100644 --- a/libs/tools/export/vault-export/vault-export-ui/jest.config.js +++ b/libs/tools/export/vault-export/vault-export-ui/jest.config.js @@ -1,10 +1,11 @@ const { pathsToModuleNameMapper } = require("ts-jest"); +const sharedConfig = require("../../../../shared/jest.config"); const { compilerOptions } = require("../../../../../tsconfig.base"); /** @type {import('jest').Config} */ module.exports = { - testMatch: ["**/+(*.)+(spec).+(ts)"], + ...sharedConfig, preset: "ts-jest", testEnvironment: "jsdom", moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, { diff --git a/libs/tools/generator/components/jest.config.js b/libs/tools/generator/components/jest.config.js index e8a7d433d1d..e0de6b1fed5 100644 --- a/libs/tools/generator/components/jest.config.js +++ b/libs/tools/generator/components/jest.config.js @@ -1,10 +1,11 @@ const { pathsToModuleNameMapper } = require("ts-jest"); +const sharedConfig = require("../../../shared/jest.config"); const { compilerOptions } = require("../../../../tsconfig.base"); /** @type {import('jest').Config} */ module.exports = { - testMatch: ["**/+(*.)+(spec).+(ts)"], + ...sharedConfig, preset: "ts-jest", testEnvironment: "../../../shared/test.environment.ts", moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, { diff --git a/libs/tools/generator/core/jest.config.js b/libs/tools/generator/core/jest.config.js index e8a7d433d1d..e0de6b1fed5 100644 --- a/libs/tools/generator/core/jest.config.js +++ b/libs/tools/generator/core/jest.config.js @@ -1,10 +1,11 @@ const { pathsToModuleNameMapper } = require("ts-jest"); +const sharedConfig = require("../../../shared/jest.config"); const { compilerOptions } = require("../../../../tsconfig.base"); /** @type {import('jest').Config} */ module.exports = { - testMatch: ["**/+(*.)+(spec).+(ts)"], + ...sharedConfig, preset: "ts-jest", testEnvironment: "../../../shared/test.environment.ts", moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, { diff --git a/libs/tools/generator/extensions/history/jest.config.js b/libs/tools/generator/extensions/history/jest.config.js index 598c83fe7d7..32cf4358cda 100644 --- a/libs/tools/generator/extensions/history/jest.config.js +++ b/libs/tools/generator/extensions/history/jest.config.js @@ -1,10 +1,11 @@ const { pathsToModuleNameMapper } = require("ts-jest"); +const sharedConfig = require("../../../../shared/jest.config"); const { compilerOptions } = require("../../../../../tsconfig.base"); /** @type {import('jest').Config} */ module.exports = { - testMatch: ["**/+(*.)+(spec).+(ts)"], + ...sharedConfig, preset: "ts-jest", testEnvironment: "../../../../shared/test.environment.ts", moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, { diff --git a/libs/tools/generator/extensions/legacy/jest.config.js b/libs/tools/generator/extensions/legacy/jest.config.js index 598c83fe7d7..32cf4358cda 100644 --- a/libs/tools/generator/extensions/legacy/jest.config.js +++ b/libs/tools/generator/extensions/legacy/jest.config.js @@ -1,10 +1,11 @@ const { pathsToModuleNameMapper } = require("ts-jest"); +const sharedConfig = require("../../../../shared/jest.config"); const { compilerOptions } = require("../../../../../tsconfig.base"); /** @type {import('jest').Config} */ module.exports = { - testMatch: ["**/+(*.)+(spec).+(ts)"], + ...sharedConfig, preset: "ts-jest", testEnvironment: "../../../../shared/test.environment.ts", moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, { diff --git a/libs/tools/generator/extensions/navigation/jest.config.js b/libs/tools/generator/extensions/navigation/jest.config.js index 598c83fe7d7..32cf4358cda 100644 --- a/libs/tools/generator/extensions/navigation/jest.config.js +++ b/libs/tools/generator/extensions/navigation/jest.config.js @@ -1,10 +1,11 @@ const { pathsToModuleNameMapper } = require("ts-jest"); +const sharedConfig = require("../../../../shared/jest.config"); const { compilerOptions } = require("../../../../../tsconfig.base"); /** @type {import('jest').Config} */ module.exports = { - testMatch: ["**/+(*.)+(spec).+(ts)"], + ...sharedConfig, preset: "ts-jest", testEnvironment: "../../../../shared/test.environment.ts", moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, { diff --git a/libs/tools/send/send-ui/jest.config.js b/libs/tools/send/send-ui/jest.config.js index 2ab935f0bfd..9dc6d56dbeb 100644 --- a/libs/tools/send/send-ui/jest.config.js +++ b/libs/tools/send/send-ui/jest.config.js @@ -1,4 +1,5 @@ const { pathsToModuleNameMapper } = require("ts-jest"); +const sharedConfig = require("../../../shared/jest.config.angular"); const { compilerOptions } = require("../../../../tsconfig.base"); @@ -7,9 +8,6 @@ const { createCjsPreset } = require("jest-preset-angular/presets"); // FIXME: Should use the shared config! const presetConfig = createCjsPreset({ tsconfig: "/tsconfig.spec.json", - astTransformers: { - before: ["/../../../shared/es2020-transformer.ts"], - }, diagnostics: { ignoreCodes: ["TS151001"], }, @@ -17,6 +15,7 @@ const presetConfig = createCjsPreset({ /** @type {import('jest').Config} */ module.exports = { + ...sharedConfig, ...presetConfig, displayName: "tools/send-ui tests", setupFilesAfterEnv: ["/test.setup.ts"], diff --git a/libs/user-core/tsconfig.spec.json b/libs/user-core/tsconfig.spec.json index 1275f148a18..512ff7465c0 100644 --- a/libs/user-core/tsconfig.spec.json +++ b/libs/user-core/tsconfig.spec.json @@ -6,5 +6,5 @@ "moduleResolution": "node10", "types": ["jest", "node"] }, - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/package-lock.json b/package-lock.json index 1b126255e63..988af50965f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,6 +60,7 @@ "oidc-client-ts": "2.4.1", "open": "10.1.2", "papaparse": "5.5.3", + "playwright": "1.56.0", "proper-lockfile": "4.1.2", "qrcode-parser": "2.1.3", "qrious": "4.0.2", @@ -33325,13 +33326,12 @@ } }, "node_modules/playwright": { - "version": "1.53.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.53.1.tgz", - "integrity": "sha512-LJ13YLr/ocweuwxyGf1XNFWIU4M2zUSo149Qbp+A4cpwDjsxRPj7k6H25LBrEHiEwxvRbD8HdwvQmRMSvquhYw==", - "dev": true, + "version": "1.56.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.0.tgz", + "integrity": "sha512-X5Q1b8lOdWIE4KAoHpW3SE8HvUB+ZZsUoN64ZhjnN8dOb1UpujxBtENGiZFE+9F/yhzJwYa+ca3u43FeLbboHA==", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.1" + "playwright-core": "1.56.0" }, "bin": { "playwright": "cli.js" @@ -33344,10 +33344,9 @@ } }, "node_modules/playwright-core": { - "version": "1.53.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.53.1.tgz", - "integrity": "sha512-Z46Oq7tLAyT0lGoFx4DOuB1IA9D1TPj0QkYxpPVUnGDqHHvDpCftu1J2hM2PiWsNMoZh8+LQaarAWcDfPBc6zg==", - "dev": true, + "version": "1.56.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.0.tgz", + "integrity": "sha512-1SXl7pMfemAMSDn5rkPeZljxOCYAmQnYLBTExuh6E8USHXGSX3dx6lYZN/xPpTz1vimXmPA9CDnILvmJaB8aSQ==", "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" @@ -33360,7 +33359,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, diff --git a/package.json b/package.json index e94d0e98522..3867d884a29 100644 --- a/package.json +++ b/package.json @@ -195,6 +195,7 @@ "oidc-client-ts": "2.4.1", "open": "10.1.2", "papaparse": "5.5.3", + "playwright": "1.56.0", "proper-lockfile": "4.1.2", "qrcode-parser": "2.1.3", "qrious": "4.0.2",