cli: explicit jest env resolution

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-11-11 10:21:17 +01:00
parent 1685f784cd
commit 4c16213e7d
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
The built-in Jest configuration now always uses the Jest environments that are bundled with the CLI by default. This avoids a situation where Jest potentially picks up an incompatible version of the environment package from a different dependency in the project.
+2 -2
View File
@@ -54,14 +54,14 @@ function getRoleConfig(role) {
case 'common-library':
case 'frontend-plugin':
case 'frontend-plugin-module':
return { testEnvironment: 'jsdom' };
return { testEnvironment: require.resolve('jest-environment-jsdom') };
case 'cli':
case 'backend':
case 'node-library':
case 'backend-plugin':
case 'backend-plugin-module':
default:
return { testEnvironment: 'node' };
return { testEnvironment: require.resolve('jest-environment-node') };
}
}