📖 Improve doc about running tests

This commit is contained in:
Andrés Moya 2024-06-05 13:47:07 +02:00
parent 3e9068b272
commit fcb21b2c4a
2 changed files with 13 additions and 27 deletions

View File

@ -94,29 +94,6 @@ using postgresql:
pg_dump -h postgres -s > schema.sql
```
## Tests ##
You can run the tests directly with:
```bash
~/penpot/backend$ clojure -M:dev:tests
```
Alternatively, you can run them from a shell. First start a REPL.
```bash
~/penpot/backend$ scripts/repl
```
And then:
```bash
user=> (run-tests)
user=> (run-tests 'namespace)
user=> (run-tests 'namespace/test)
```
## Linter ##
There are no watch process for the linter; you will need to execute it

View File

@ -337,13 +337,22 @@ Or for some specific output:
### Running tests in the REPL
An alternative way of running tests is to do it from inside the REPL you can
use in the backend and common apps in the [development environment](/technical-guide/developer/devenv).
An alternative way of running tests is to do it from inside the
[REPL](/technical-guide/developer/backend/#repl) you can use in the backend and
common apps in the development environment.
We have a helper function `(run-tests)` that refresh the environment (to avoid
We have a helper function `(run-tests)` that refreshes the environment (to avoid
having [stale tests](https://practical.li/clojure/testing/unit-testing/#command-line-test-runners))
and runs all tests or a selection. It is defined in `backend/dev/user.clj` and
`common/dev/user.clj`, so it's available in the REPL without importing anything.
`common/dev/user.clj`, so it's available without importing anything.
First start a REPL:
```bash
~/penpot/backend$ scripts/repl
```
And then:
```clojure
;; To run all tests