backend-test-utils: sync feature compat unwrapping
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/backend-test-utils': patch
|
||||
---
|
||||
|
||||
Sync feature installation compatibility logic with `@backstage/backend-app-api`.
|
||||
@@ -209,10 +209,19 @@ function isPromise<T>(value: unknown | Promise<T>): value is Promise<T> {
|
||||
);
|
||||
}
|
||||
|
||||
// Same as in the backend-app-api, handles double defaults from dynamic imports
|
||||
function unwrapFeature(
|
||||
feature: BackendFeature | (() => BackendFeature),
|
||||
feature: BackendFeature | { default: BackendFeature },
|
||||
): BackendFeature {
|
||||
return typeof feature === 'function' ? feature() : feature;
|
||||
if ('$$type' in feature) {
|
||||
return feature;
|
||||
}
|
||||
|
||||
if ('default' in feature) {
|
||||
return feature.default;
|
||||
}
|
||||
|
||||
return feature;
|
||||
}
|
||||
|
||||
const backendInstancesToCleanUp = new Array<Backend>();
|
||||
|
||||
Reference in New Issue
Block a user