Skip to content

Commit 01b3008

Browse files
committed
Update the contributing guide
1 parent e14bfbc commit 01b3008

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

Diff for: CONTRIBUTING.md

+28-8
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,50 @@ Please use [Prettier](https://prettier.io/) to format the code.
66

77
## Tests
88

9-
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.
9+
### Unit tests
1010

11-
### How to run tests?
11+
Before running unit tests for the first time, you need to download the Firestore emulator by running the command:
12+
13+
```bash
14+
make test-setup
15+
```
1216

1317
To run the tests:
1418

1519
```bash
16-
# Run tests both in Node.js and browser:
20+
# Run tests once
1721
make test
1822

23+
# Run tests in the watch mode
24+
make test-watch
25+
```
26+
27+
### System tests
28+
29+
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.
30+
31+
#### How to run system tests?
32+
33+
To run the tests:
34+
35+
```bash
36+
# Run tests both in Node.js and browser:
37+
make test-system
38+
1939
# Run only Node.js tests:
20-
make test-node
40+
make test-system-node
2141

2242
# Run Node.js tests in the watch mode:
23-
make test-node-watch
43+
make test-system-node-watch
2444

2545
# Run only browser tests:
26-
make test-node
46+
make test-system-browser
2747

2848
# Run browser tests in the watch mode:
29-
make test-node-watch
49+
make test-system-browser-watch
3050
```
3151

32-
### How to set up tests?
52+
#### How to set up system tests?
3353

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

Diff for: Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ test:
1010
test-watch:
1111
${BIN}/firebase emulators:exec --only firestore "${BIN}/jest --env node --watch"
1212

13+
test-setup:
14+
${BIN}/firebase setup:emulators:firestore
15+
1316
test-system: test-system-node test-system-browser
1417

1518
test-system-node:

0 commit comments

Comments
 (0)