Skip to main content

createMockDirectory()

Home > @backstage/backend-test-utils > createMockDirectory

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

Signature:

function createMockDirectory(options?: CreateMockDirectoryOptions): MockDirectory;

Parameters

Parameter

Type

Description

options

CreateMockDirectoryOptions

(Optional)

**Returns:**

MockDirectory

Remarks

This method is intended to be called outside of any test, either at top-level or within a describe block. It will call afterAll to make sure that the mock directory is removed after the tests have run.

Example

describe('MySubject', () => {
const mockDir = createMockDirectory();

beforeEach(mockDir.clear);

it('should work', () => {
// ... use mockDir
})
})