From 5c70e30c1376f609992218bc499bc86f90982f52 Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Wed, 14 Apr 2021 11:12:43 +0200 Subject: [PATCH] Add tests section to contributing --- CONTRIBUTING.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bec8064..4b9706c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -59,3 +59,25 @@ From time to time (eg. when preparing releases), we can update translated conten ## 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). + +## 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" +```