🔬 Testing: move towards a more explicit approach #1871
cameron-robey
started this conversation in
RFCs
Replies: 3 comments 1 reply
-
I've been burned several times by our global mocking approach, would love us to move towards a model where you can glance at a test, and know "the state of the universe" as it executes. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Two adjacent issues:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Just linking these here so they get thought about alongside the overarching discussion about testing: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Our current testing is full of a mixture of mocks and handlers that are either called explicitly, or run under the hood for all tests. An example of something called explicitly are
runInTmpDir()
, and something not called explicitly is the mocking of fetch by jest (which is in works to be replaced by MSW in the eventual move to vitest).The approach we want to move towards is the explicit approach: we want to know all the behaviour change that might be present in a test by reading the test.
In essence, a new test written with no mocks or handlers called should run the test exactly as expected. In order to mock things or change behaviour we called a hook or equivalent to enable it for that particular test or suite of tests.
This will make our tests more verbose, however this is a tradeoff worth making to make it much easier to read and develop tests (especially for those unfamiliar with our codebase).
Beta Was this translation helpful? Give feedback.
All reactions