Skip to main content

MockDirectory

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

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

Signature:

export interface MockDirectory 

Properties

Property

Modifiers

Type

Description

path

readonly

string

The path to the root of the mock directory

Methods

Method

Description

addContent(root)

Adds content of the mock directory. This will overwrite existing files.

clear()

Clears the content of the mock directory, ensuring that the directory itself exists.

content(options)

Reads the content of the mock directory.

remove()

Removes the mock directory and all its contents.

resolve(paths)

Resolves a path relative to the root of the mock directory.

setContent(root)

Sets the content of the mock directory. This will remove any existing content.