diff --git a/src/lib/library/library.factory.ts b/src/lib/library/library.factory.ts index 3d641675a..6b9796436 100644 --- a/src/lib/library/library.factory.ts +++ b/src/lib/library/library.factory.ts @@ -113,11 +113,9 @@ function updateJestConfig( if (!jestOptions.moduleNameMapper) { jestOptions.moduleNameMapper = {}; } - const packageKeyRegex = '^' + packageKey + '$'; - const deepPackagePathRegex = '^' + packageKey + '/(.*)' + '$'; + const packageKeyRegex = '^' + packageKey + '(|/.*)$'; const packageRoot = join('' as Path, distRoot); - jestOptions.moduleNameMapper[deepPackagePathRegex] = join(packageRoot, '$1'); - jestOptions.moduleNameMapper[packageKeyRegex] = packageRoot; + jestOptions.moduleNameMapper[packageKeyRegex] = join(packageRoot, '$1'); } function updateNpmScripts(