diff --git a/.changeset/lovely-news-relax.md b/.changeset/lovely-news-relax.md new file mode 100644 index 0000000000..01e3f500d1 --- /dev/null +++ b/.changeset/lovely-news-relax.md @@ -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. diff --git a/packages/cli/config/jest.js b/packages/cli/config/jest.js index 18f563a3a3..4b9fcd3d8e 100644 --- a/packages/cli/config/jest.js +++ b/packages/cli/config/jest.js @@ -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') }; } }