Skip to content

Commit

Permalink
Update the contributing guide
Browse files Browse the repository at this point in the history
  • Loading branch information
kossnocorp committed Jan 2, 2020
1 parent e14bfbc commit 01b3008
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
36 changes: 28 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,50 @@ Please use [Prettier](https://prettier.io/) to format the code.

## Tests

As Typesaurus itself, its tests work both in browser and Node.js. Typesaurus tests connect to a real database, so to run them, you need to prepare a Firebase project and point the suite to the project. See [How to set up tests?](#how-to-set-up-tests) for more details.
### Unit tests

### How to run tests?
Before running unit tests for the first time, you need to download the Firestore emulator by running the command:

```bash
make test-setup
```

To run the tests:

```bash
# Run tests both in Node.js and browser:
# Run tests once
make test

# Run tests in the watch mode
make test-watch
```

### System tests

As Typesaurus itself, its tests work both in browser and Node.js. Typesaurus system tests connect to a real database, so to run them, you need to prepare a Firebase project and point the suite to the project. See [How to set up tests?](#how-to-set-up-system-tests) for more details.

#### How to run system tests?

To run the tests:

```bash
# Run tests both in Node.js and browser:
make test-system

# Run only Node.js tests:
make test-node
make test-system-node

# Run Node.js tests in the watch mode:
make test-node-watch
make test-system-node-watch

# Run only browser tests:
make test-node
make test-system-browser

# Run browser tests in the watch mode:
make test-node-watch
make test-system-browser-watch
```

### How to set up tests?
#### How to set up system tests?

1. First of all, [create a Firebase project](https://console.firebase.google.com/) and [enable Firestore](https://console.firebase.google.com/project/_/storage).

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ test:
test-watch:
${BIN}/firebase emulators:exec --only firestore "${BIN}/jest --env node --watch"

test-setup:
${BIN}/firebase setup:emulators:firestore

test-system: test-system-node test-system-browser

test-system-node:
Expand Down

0 comments on commit 01b3008

Please sign in to comment.