Page Contents

Home > @loopback/testlab > TestSandbox

TestSandbox class

TestSandbox class provides a convenient way to get a reference to a sandbox folder in which you can perform operations for testing purposes.

Signature:

export declare class TestSandbox 

Constructors

Constructor Modifiers Description
(constructor)(path)   Will create a directory if it doesn’t already exist. If it exists, you still get an instance of the TestSandbox.

Properties

Property Modifiers Type Description
path   string  

Methods

Method Modifiers Description
copyFile(src, dest)   Copies a file from src to the TestSandbox. If copying a .js file which has an accompanying .js.map file in the src file location, the dest file will have its sourceMappingURL updated to point to the original file as an absolute path so you don’t need to copy the map file.
delete()   Deletes the TestSandbox.
getPath()   Returns the path of the TestSandbox
mkdir(dir)   Makes a directory in the TestSandbox
reset()   Resets the TestSandbox. (Remove all files in it).