Skip to main content
Version: Next

@backstage/backend-test-utils

Home > @backstage/backend-test-utils

Test helpers library for Backstage backends

Classes

ClassDescription
ServiceFactoryTesterA utility to help test service factories in isolation.
TestCachesEncapsulates the creation of ephemeral test cache instances for use inside unit or integration tests.
TestDatabasesEncapsulates the creation of ephemeral test database instances for use inside unit or integration tests.

Functions

FunctionDescription
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

InterfaceDescription
CreateMockDirectoryOptionsOptions for createMockDirectory().
MockDirectoryA utility for creating a mock directory that is automatically cleaned up.
MockDirectoryContentCallbackContextA context that allows for more advanced file system operations when writing mock directory content.
MockDirectoryContentOptionsOptions for MockDirectory.content().
ServiceFactoryTesterOptionsOptions for ServiceFactoryTester.
TestBackend
TestBackendOptions

Namespaces

NamespaceDescription
mockCredentials
mockServices

Type Aliases

Type AliasDescription
MockDirectoryContentThe content of a mock directory represented by a nested object structure.
MockDirectoryContentCallbackA callback that allows for more advanced file system operations when writing mock directory content.
ServiceMock
TestCacheIdThe possible caches to test against.
TestDatabaseIdThe possible databases to test against.