Skip to main content
Version: Next

@backstage/backend-test-utils

Home > @backstage/backend-test-utils

Test helpers library for Backstage backends

Classes

Class

Description

ServiceFactoryTester

A utility to help test service factories in isolation.

TestCaches

Encapsulates the creation of ephemeral test cache instances for use inside unit or integration tests.

TestDatabases

Encapsulates the creation of ephemeral test database instances for use inside unit or integration tests.

Functions

Function

Description

createMockDirectory(options)

Creates a new temporary mock directory that will be removed after the tests have completed.

mockErrorHandler()

A mock for error handler middleware that can be used in router tests.

registerMswTestHooks(worker)

Sets up handlers for request mocking

startTestBackend(options)

Interfaces

Interface

Description

CreateMockDirectoryOptions

Options for createMockDirectory().

MockDirectory

A utility for creating a mock directory that is automatically cleaned up.

MockDirectoryContentCallbackContext

A context that allows for more advanced file system operations when writing mock directory content.

MockDirectoryContentOptions

Options for MockDirectory.content().

ServiceFactoryTesterOptions

Options for ServiceFactoryTester.

TestBackend

TestBackendOptions

Namespaces

Namespace

Description

mockCredentials

mockServices

Mock implementations of the core services, to be used in tests.

Type Aliases

Type Alias

Description

MockDirectoryContent

The content of a mock directory represented by a nested object structure.

MockDirectoryContentCallback

A callback that allows for more advanced file system operations when writing mock directory content.

ServiceMock

TestCacheId

The possible caches to test against.

TestDatabaseId

The possible databases to test against.