From c9b806d30bd9614c6b8acaa7e36f6cedaff98fa5 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Wed, 26 Mar 2025 13:35:19 +0200 Subject: [PATCH] fix: Check if tsconfig paths exists in jest config (no-changelog) (#14182) --- jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index e089238141..d85107ac83 100644 --- a/jest.config.js +++ b/jest.config.js @@ -24,7 +24,7 @@ const config = { '^.+\\.ts$': ['ts-jest', tsJestOptions], }, // This resolve the path mappings from the tsconfig relative to each jest.config.js - moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: `${compilerOptions.baseUrl ? `/${compilerOptions.baseUrl.replace(/^\.\//, '')}` : ''}` }), + moduleNameMapper: compilerOptions?.paths ? pathsToModuleNameMapper(compilerOptions.paths, { prefix: `${compilerOptions.baseUrl ? `/${compilerOptions.baseUrl.replace(/^\.\//, '')}` : ''}` }) : {}, setupFilesAfterEnv: ['jest-expect-message'], collectCoverage: isCoverageEnabled, coverageReporters: ['text-summary', 'lcov', 'html-spa'],