---
lang: en
title: 'API docs: testlab.testsandbox'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/testlab
permalink: /doc/en/lb4/apidocs.testlab.testsandbox.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/testlab](./testlab.md) &gt; [TestSandbox](./testlab.testsandbox.md)

## 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:**

```typescript
export declare class TestSandbox 
```

## Constructors

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)(rootPath, options)](./testlab.testsandbox._constructor_.md) |  | 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](./testlab.testsandbox.path.md) | <code>readonly</code> | string |  |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [copyFile(src, dest, transform)](./testlab.testsandbox.copyfile.md) |  | Copies a file from src to the TestSandbox. If copying a <code>.js</code> file which has an accompanying <code>.js.map</code> 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()](./testlab.testsandbox.delete.md) |  | Deletes the TestSandbox. |
|  [mkdir(dir)](./testlab.testsandbox.mkdir.md) |  | Makes a directory in the TestSandbox |
|  [reset()](./testlab.testsandbox.reset.md) |  | Resets the TestSandbox. (Remove all files in it). |
|  [writeJsonFile(dest, data)](./testlab.testsandbox.writejsonfile.md) |  | Creates a new file and writes the given data serialized as JSON. |
|  [writeTextFile(dest, data)](./testlab.testsandbox.writetextfile.md) |  | Creates a new file and writes the given data as a UTF-8-encoded text. |


