To run all tests:
make test
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
make test WATCH=true
Developers can also manually change the shadow-cljs option :ns-regex
to control which namespaces the test runner should pick.
The most convenient way to develop and run test locally is using REPL:
- Run command
make test-watch-for-repl
. - Once you see the message
[repl] shadow-cljs - #3 ready!
you can connect a REPL to the:test
target from VS Code, Emacs, etc. - In any test namespace, run cljs.test/run-tests or your preferred method to run tests in the current namespace.
You can run single test in REPL like this
(require 'cljs.test)
(cljs.test/test-var #'status-im.data-store.chats-test/normalize-chat-test)
Tests will use the bindings in modules/react-native-status/nodejs
, if you make any changes to these you will need to restart the watcher.
In the video below, you can see two buffers side-by-side. On the left the source implementation, on the right the REPL buffer. Whenever a keybinding is pressed, tests in the current namespace instantly run. You can achieve this exact flow in VS Code, IntelliJ, Vim, etc.
2022-12-19.12-46.webm
Here I'm showing a terminal-only experience using Tmux (left pane Emacs, right pane the output coming from running the make target).
2022-12-19.13-17.webm
To run tests:
make test-component
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
make test-component-watch
Check component tests doc for more.
To run unit tests:
make test-unit
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
make test-unit WATCH=true
To run integration tests:
make test-integration
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
make test-integration WATCH=true