2023-10-11 21:53:34 +00:00
|
|
|
{:config-paths ["status-im"]
|
2023-12-19 17:41:30 +00:00
|
|
|
:lint-as {legacy.status-im.utils.views/defview clojure.core/defn
|
|
|
|
legacy.status-im.utils.views/letsubs clojure.core/let
|
|
|
|
reagent.core/with-let clojure.core/let
|
|
|
|
legacy.status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
|
|
|
|
utils.re-frame/defn clj-kondo.lint-as/def-catch-all
|
|
|
|
quo.react/with-deps-check clojure.core/fn
|
|
|
|
quo.previews.preview/list-comp clojure.core/for
|
|
|
|
legacy.status-im.utils.styles/def clojure.core/def
|
|
|
|
legacy.status-im.utils.styles/defn clojure.core/defn
|
|
|
|
test-helpers.unit/deftest-sub clojure.core/defn
|
|
|
|
taoensso.tufte/defnp clojure.core/defn}
|
2023-10-05 18:50:57 +00:00
|
|
|
:linters {:case-duplicate-test {:level :error}
|
|
|
|
:case-quoted-test {:level :error}
|
|
|
|
:case-symbol-test {:level :error}
|
|
|
|
:clj-kondo-config {:level :error}
|
2023-09-14 14:28:43 +00:00
|
|
|
:cond-else {:level :error}
|
|
|
|
:consistent-alias {:level :error
|
2024-02-06 16:24:45 +00:00
|
|
|
:aliases {clojure.set set
|
|
|
|
clojure.string string
|
|
|
|
clojure.walk walk
|
|
|
|
malli.core malli
|
|
|
|
malli.dev.pretty malli.pretty
|
|
|
|
malli.dev.virhe malli.virhe
|
|
|
|
malli.error malli.error
|
|
|
|
malli.generator malli.generator
|
|
|
|
malli.transform malli.transform
|
|
|
|
malli.util malli.util
|
Make integration tests more enjoyable to use (#19025)
This commit brings numerous improvements to integration tests. The next step
will be to apply the same improvements to contract tests.
Fixes https://github.com/status-im/status-mobile/issues/18676
Improvements:
- Setting up the application and logged account per test is now done with an
async test fixture, which is a very idiomatic way to solve this problem. No
need anymore to write macros to wrap day8.re-frame.test/wait-for. The macros
in test-helpers.integration will be removed once we apply the same
improvements to contract tests.
- Integration test timeouts can be controlled per test, with a configurable,
global default (60s).
- Now the integration test suite will fail-fast by default, i.e. a test failure
short-circuits the entire suite immediately. This option can be overridden on
a test-by-test basis. This improvement is very useful when investigating
failures because the error will be shown on the spot, with no need to search
backwards across lots of logs.
- Noisy messages from re-frame can be silenced with a test fixture. We can
silence even more in the future if we remove the hardcoded printf call from
C++ on every signal and control it with Clojure. We can disable most logs as
well with the more direct (status-im.common.log/setup "ERROR") at the top of
tests.integration-test.core. We can make verbosity even more convenient to
control, but I think this should be designed outside this PR.
- Removed dependency on lib day8.re-frame/test for integration tests (see
detailed explanation below).
- Each call to (our) wait-for can customize the timeout to process re-frame
event IDs passed to it.
- Syntax is now flat, instead of being nested on every call to wait-for. You
can now compose other async operations anywhere in a test.
Notes:
- promesa.core/do is essential in the integration test suite, as it makes sync &
async operations play nice with each other without the developer having to
promisify anything manually.
- There are lots of logs related to async storage ("unexpected token u in JSON at
position..."). This isn't fixed yet.
Are we not going to use day8.re-frame.test?
We don't need this library in integration tests and we won't need it in contract
tests. Whether it will be useful after we remove it from integration and
contract tests is yet to be seen (probably not).
A few reasons:
- The async model of promises is well understood and battle tested. The one
devised in the lib is poorly understood and rigid.
- There's basically no way to correctly integrate other async operations in the
test, unless they can be fully controlled via re-frame events. For instance,
how would you control timeouts? How would you retry in a test? How would
forcefully delay an operation by a few seconds? These things are useful (to me
at least) when developing integration/contract tests.
- Every call to day8.re-frame.test/wait-for forces you to nest code one more
level. Code readability suffers from that choice.
- Have you ever looked up the implementation of wait-for? It's quite convoluted.
One could say the source code is not that important, but many times I had to
look it up because I couldn't understand the async model they built with their
macro approach. The de facto primitive in JS for asynchronicity is promises,
and we fully leverage it in this PR.
- The lib has an interesting macro run-test-sync, but we have no usage for it. I
used it in status-mobile for a while. At one point, all event unit tests for
the Activity Center used it (e.g. commit
08fb0de7b09beec83e91567cbf2ff795cde39f3f), but I replaced them with the
simpler pure function style.
2024-03-05 01:38:42 +00:00
|
|
|
promesa.core p
|
2024-02-06 16:24:45 +00:00
|
|
|
schema.core schema
|
|
|
|
status-im.feature-flags ff
|
|
|
|
taoensso.timbre log}}
|
2023-10-05 18:50:57 +00:00
|
|
|
:deprecated-namespace {:level :warning}
|
2023-09-14 14:28:43 +00:00
|
|
|
:docstring-blank {:level :error}
|
2023-10-05 18:50:57 +00:00
|
|
|
:equals-true {:level :error}
|
2023-09-14 14:28:43 +00:00
|
|
|
:inline-def {:level :error}
|
2023-12-19 17:41:30 +00:00
|
|
|
:invalid-arity {:skip-args [legacy.status-im.utils.fx/defn
|
|
|
|
utils.re-frame/defn]}
|
2023-09-14 14:28:43 +00:00
|
|
|
:loop-without-recur {:level :error}
|
2023-10-05 18:50:57 +00:00
|
|
|
:minus-one {:level :error}
|
2023-09-14 14:28:43 +00:00
|
|
|
:misplaced-docstring {:level :error}
|
|
|
|
:missing-body-in-when {:level :error}
|
|
|
|
:missing-clause-in-try {:level :error}
|
|
|
|
:missing-else-branch {:level :error}
|
|
|
|
:not-empty? {:level :error}
|
2023-10-05 18:50:57 +00:00
|
|
|
:plus-one {:level :error}
|
2023-09-14 14:28:43 +00:00
|
|
|
:redundant-do {:level :error}
|
|
|
|
:redundant-let {:level :error}
|
|
|
|
:refer-all {:level :error}
|
|
|
|
:shadowed-var {:level :error
|
|
|
|
;; We temporarily use :include to define an
|
|
|
|
;; allowlist of core Clojure vars. In the
|
|
|
|
;; future, as we progressively fix shadowed
|
|
|
|
;; vars, we should be able to delete this
|
|
|
|
;; option and lint all vars.
|
|
|
|
:exclude [type name]}
|
|
|
|
:single-operand-comparison {:level :error}
|
|
|
|
:syntax {:level :error}
|
|
|
|
:unbound-destructuring-default {:level :error}
|
2023-10-16 22:03:18 +00:00
|
|
|
:uninitialized-var {:level :error}
|
2023-09-14 14:28:43 +00:00
|
|
|
:unknown-require-option {:level :error}
|
|
|
|
:unreachable-code {:level :error}
|
|
|
|
:unresolved-namespace {:level :error}
|
2022-12-20 13:42:50 +00:00
|
|
|
;; TODO remove number when this is fixed
|
|
|
|
;; https://github.com/borkdude/clj-kondo/issues/867
|
2023-09-14 14:28:43 +00:00
|
|
|
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY
|
|
|
|
number
|
2023-12-19 17:41:30 +00:00
|
|
|
legacy.status-im.test-helpers/restore-app-db]}
|
2023-09-14 14:28:43 +00:00
|
|
|
:unresolved-var {:level :error}
|
2023-10-16 22:03:18 +00:00
|
|
|
:unsorted-required-namespaces {:level :error}
|
2023-10-05 18:50:57 +00:00
|
|
|
:unused-alias {:level :warning}
|
2023-09-14 14:28:43 +00:00
|
|
|
:unused-binding {:level :error}
|
|
|
|
:unused-import {:level :error}
|
|
|
|
:unused-namespace {:level :error}
|
|
|
|
:unused-private-var {:level :error}
|
|
|
|
:unused-referred-var {:level :error}
|
|
|
|
:use {:level :error}}
|
2022-12-20 13:42:50 +00:00
|
|
|
:config-in-ns {mocks.js-dependencies {:linters {:clojure-lsp/unused-public-var {:level :off}}}}}
|