cli: update Jest 27 changeset + make node env default
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
'@backstage/cli': minor
|
||||
---
|
||||
|
||||
Bump the version range of `jest` from `^26.0.1` to `^27.4.7`. You can find the complete list of breaking changes [here](https://github.com/facebook/jest/releases/tag/v27.0.0).
|
||||
**BREAKING**: Bump the version range of `jest` from `^26.0.1` to `^27.5.1`. You can find the complete list of breaking changes [here](https://github.com/facebook/jest/releases/tag/v27.0.0).
|
||||
|
||||
One of the main breaking changes in Jest 27 is that the default test environment is now `node` rather than `jsdom`. However, this is counteracted in the default Jest configuration provided by the Backstage CLI, as it still defaults the environment to `jsdom`. The future addition of the Backstage package `"role"` field will override this default, setting the test environment to the appropriate value for the role.
|
||||
We strongly recommend to have completed the [package role migration](https://backstage.io/docs/tutorials/package-role-migration) before upgrading to this version, as the package roles are used to automatically determine the testing environment for each package. If you instead want to set an explicit test environment for each package, you can do so for example in the `"jest"` section in `package.json`. The default test environment for all packages is now `node`, which is also the new Jest default.
|
||||
|
||||
Note that one of the breaking changes of Jest 27 is that the `jsdom` environment no longer includes `setImmediate` and `clearImmediate`, which means you might need to update some of your frontend packages. Another notable change is that `jest.useFakeTimers` now defaults to the `'modern'` implementation, which also mocks microtasks.
|
||||
|
||||
@@ -170,6 +170,7 @@ memoized
|
||||
microservice
|
||||
microservices
|
||||
microsite
|
||||
microtasks
|
||||
middleware
|
||||
minikube
|
||||
Minikube
|
||||
|
||||
@@ -44,13 +44,13 @@ function getRoleConfig(role) {
|
||||
case 'common-library':
|
||||
case 'frontend-plugin':
|
||||
case 'frontend-plugin-module':
|
||||
default:
|
||||
return { testEnvironment: 'jsdom' };
|
||||
case 'cli':
|
||||
case 'backend':
|
||||
case 'node-library':
|
||||
case 'backend-plugin':
|
||||
case 'backend-plugin-module':
|
||||
default:
|
||||
return { testEnvironment: 'node' };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user