From c4ccf5f0953e1825cd43da8eead5b42a05c26563 Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Tue, 1 Oct 2024 16:30:47 -0400 Subject: [PATCH] chore: centralize jest config for angular, module mapping (#1030) see title. Signed-off-by: Todd Baert --- jest.config.ts | 21 ++++++++++++++++++++- packages/angular/jest.config.ts | 21 --------------------- 2 files changed, 20 insertions(+), 22 deletions(-) delete mode 100644 packages/angular/jest.config.ts diff --git a/jest.config.ts b/jest.config.ts index d36f40943..161e5d085 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -189,7 +189,26 @@ export default { ], }, }, - '/packages/angular', + { + displayName: 'angular', + testEnvironment: 'jsdom', + preset: 'jest-preset-angular', + testMatch: ['/packages/angular/projects/angular-sdk/src/**/*.spec.{ts,tsx}'], + setupFilesAfterEnv: ['/packages/angular/setup-jest.ts'], + moduleNameMapper: { + '@openfeature/core': '/packages/shared/src', + '@openfeature/web-sdk': '/packages/web/src', + }, + transform: { + '^.+\\.(ts|js|html|svg)$': [ + 'jest-preset-angular', + { + tsconfig: '/packages/angular/tsconfig.json', + isolatedModules: true, + }, + ], + }, + } ], // Use this configuration option to add custom reporters to Jest diff --git a/packages/angular/jest.config.ts b/packages/angular/jest.config.ts deleted file mode 100644 index 7d54dbec0..000000000 --- a/packages/angular/jest.config.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * For a detailed explanation regarding each configuration property, visit: - * https://jestjs.io/docs/configuration - */ - -import type { Config } from 'jest'; - -const config: Config = { - displayName: 'angular', - clearMocks: true, - collectCoverage: true, - coverageDirectory: 'coverage', - coverageProvider: 'v8', - testEnvironment: 'jsdom', - preset: 'jest-preset-angular', - setupFilesAfterEnv: ['/setup-jest.ts'], - modulePathIgnorePatterns: ['/dist'], - testMatch: ['/projects/angular-sdk/src/**/*.spec.{ts,tsx}'], -}; - -export default config;