> For the complete documentation index, see [llms.txt](https://docs.testery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.testery.io/how-to/running-scripts-before-the-tests.md).

# Running Scripts Before the Tests

Sometimes in your javascript/typescript projects you would like to run additional steps before the test runner runs. This could be used for setting up dependencies, transpiling code, or various other things to help your tests run more smoothly.

In order to support this, Testery provides the ability to define a section of your package.json that will run prior to the tests.

To do this, locate the `scripts` section of your `package.json` and add a string parameter for `testeryPreRunScript`. Say you wanted to install the `vim` system package on all of your runners. Your script would look something like this: `"testeryPreRunScript": "apt-get install -y vim".`

```
{
  "scripts":
    "testeryPreRunScript":"{{YOUR SCRIPTS GO HERE}}",
    ...
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.testery.io/how-to/running-scripts-before-the-tests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
