Enable clearMocks in Jest configuration
Description
Let's set clearMocks
to true
in our Jest configuration.
Why?
- This way tests don't bump into eachother.
- There's a lot of confusion between
clear
,restore
, andreset
when developers manually add theclear
. In my experience,jest.clearAllMocks
is what we inteded to do 99% of the time.
Context
The following discussion from !21856 (merged) should be addressed:
-
@winh started a discussion: (+1 comment) shall we consider https://jestjs.io/docs/en/configuration.html#clearmocks-boolean?
shall we consider a follow-up issue?
Edited by Inactive Account