From 6c23efd539d6938b3c03b8c4f3d38d533e6c8d81 Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Tue, 7 Oct 2025 21:44:36 +0200 Subject: [PATCH] frontend-test-utils: api-reports Signed-off-by: Vincenzo Scamporlino --- packages/frontend-test-utils/report.api.md | 13 +++++++++++++ .../frontend-test-utils/src/app/renderTestApp.tsx | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/packages/frontend-test-utils/report.api.md b/packages/frontend-test-utils/report.api.md index db31c082ea..58e5282f48 100644 --- a/packages/frontend-test-utils/report.api.md +++ b/packages/frontend-test-utils/report.api.md @@ -29,6 +29,7 @@ import { RouteRef } from '@backstage/frontend-plugin-api'; import { TestApiProvider } from '@backstage/test-utils'; import { TestApiProviderProps } from '@backstage/test-utils'; import { TestApiRegistry } from '@backstage/test-utils'; +import { testingLibraryDomTypesQueries } from '@testing-library/dom/types/queries'; import { withLogCollector } from '@backstage/test-utils'; export { ApiMock }; @@ -119,6 +120,18 @@ export function renderInTestApp( options?: TestAppOptions, ): RenderResult; +// @public +export function renderTestApp( + options: RenderTestAppOptions, +): RenderResult; + +// @public +export type RenderTestAppOptions = { + config?: JsonObject; + extensions: ExtensionDefinition[]; + features?: FrontendFeature[]; +}; + export { TestApiProvider }; export { TestApiProviderProps }; diff --git a/packages/frontend-test-utils/src/app/renderTestApp.tsx b/packages/frontend-test-utils/src/app/renderTestApp.tsx index 1644ee1c30..827d14283c 100644 --- a/packages/frontend-test-utils/src/app/renderTestApp.tsx +++ b/packages/frontend-test-utils/src/app/renderTestApp.tsx @@ -26,6 +26,11 @@ import appPlugin from '@backstage/plugin-app'; import { JsonObject } from '@backstage/types'; import { ConfigReader } from '@backstage/config'; +/** + * Options for `renderTestApp`. + * + * @public + */ export type RenderTestAppOptions = { /** * Additional configuration passed to the app when rendering elements inside it. @@ -50,6 +55,12 @@ const appPluginOverride = appPlugin.withOverrides({ ], }); +/** + * Renders the provided extensions inside a Backstage app, returning the same + * utilities as `@testing-library/react` `render` function. + * + * @public + */ export function renderTestApp(options: RenderTestAppOptions) { const features: FrontendFeature[] = [ createFrontendPlugin({