# Basic Jest and Typescript setup

Writing this up so I have somewhere to quickly grab basic Jest setup. This information is copied from the [Jest Documentation Site](https://jestjs.io/docs/getting-started) compressed into just the parts I'm interested in.

## Create folders

```plaintext
mkdir -p <project>/src
cd <project>
```

## Install and init

```plaintext
npm init -y
npm install --save-dev jest  @babel/preset-typescript @types/jest @babel/preset-env @babel/preset-typescript
jest --init
```

## Babel config file

Create a file called `babel.config.js` in the project root folder with the contents:

```plaintext
module.exports = {
  presets: [
    ["@babel/preset-env", { targets: { node: "current" } }],
    "@babel/preset-typescript",
  ],
};
```

## Test script

Add a test script to `package.json` to easily run Jest in watch mode.

```plaintext
"test": "jest --watchAll"
```
