Skip to main content
Version: Next

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

Parameter

Type

Description

Component

ComponentType<PropsWithChildren<{}>> | ReactNode

A component or react node to render inside the test app.

options

TestAppOptions & LegacyRootOption

(Optional) Additional options for the rendering.

**Returns:**

Promise<RenderResult>