Add tests section to contributing

This commit is contained in:
Norbert Renner 2021-04-14 11:12:43 +02:00
parent 06f1c77774
commit 5c70e30c13

View file

@ -59,3 +59,25 @@ From time to time (eg. when preparing releases), we can update translated conten
## License ## License
BRouter is licensed under [MIT](LICENSE). Please make sure before adding any library that it is compatible with that. (GPL licenses are incompatible for instance). BRouter is licensed under [MIT](LICENSE). Please make sure before adding any library that it is compatible with that. (GPL licenses are incompatible for instance).
## Tests
[Jest](https://jestjs.io/) is used for unit tests.
Tests are located in the `tests` directory in the project root. The idea is to mirror the structure in the `js` directory and to have a test file for each file there with the same name, but with a `.test.js` suffix (which is how tests are found).
Examples for running tests (see [CLI Options](https://jestjs.io/docs/cli)):
```sh
# run all tests
yarn test
# watch to run affected tests for changed files while developing
yarn test --watch
# run specific test file only (while watching or without)
yarn test --watch tests/format/Gpx.test.js
# run a single test by name (regex for name passed to describe/test functions)
yarn test --verbose -t="2-locus"
```