cli: disable caching Jest module loader for node
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
---
|
||||
|
||||
Only use the caching Jest module loader for frontend packages in order to avoid breaking real ESM module imports.
|
||||
@@ -212,6 +212,11 @@ function getRoleConfig(role, pkgJson) {
|
||||
if (FRONTEND_ROLES.includes(role)) {
|
||||
return {
|
||||
testEnvironment: require.resolve('jest-environment-jsdom'),
|
||||
// The caching module loader is only used to speed up frontend tests,
|
||||
// as it breaks real dynamic imports of ESM modules.
|
||||
runtime: envOptions.oldTests
|
||||
? undefined
|
||||
: require.resolve('./jestCachingModuleLoader'),
|
||||
transform,
|
||||
};
|
||||
}
|
||||
@@ -257,10 +262,6 @@ async function getProjectConfig(targetPath, extraConfig, extraOptions) {
|
||||
// A bit more opinionated
|
||||
testMatch: [`**/*.test.{${SRC_EXTS.join(',')}}`],
|
||||
|
||||
runtime: envOptions.oldTests
|
||||
? undefined
|
||||
: require.resolve('./jestCachingModuleLoader'),
|
||||
|
||||
transformIgnorePatterns: [`/node_modules/(?:${transformIgnorePattern})/`],
|
||||
...getRoleConfig(pkgJson.backstage?.role, pkgJson),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user