Skip to main content

renderInTestApp()

Home > @backstage/test-utils > renderInTestApp

Renders a component inside a Backstage test app, providing a mocked theme and app context, along with mocked APIs.

The render executes async effects similar to renderWithEffects. To avoid this behavior, use a regular render() + wrapInTestApp() instead.

Signature:

function renderInTestApp(Component: ComponentType<PropsWithChildren<{}>> | ReactNode, options?: TestAppOptions & LegacyRootOption): Promise<RenderResult>;

Parameters

ParameterTypeDescription
ComponentComponentType<PropsWithChildren<{}>> | ReactNodeA component or react node to render inside the test app.
optionsTestAppOptions & LegacyRootOption(Optional) Additional options for the rendering.

Returns:

Promise<RenderResult>