feat(jest): restrict usage of toBeTruthy or toBeFalsy
requested to merge ali_o_kan/eslint-plugin:374983-add-rule-to-restrict-usage-of-tobetruthy-or-tobefalsy into main
Context
Avoid using
toBeTruthy
ortoBeFalsy
Jest also provides following matchers:
toBeTruthy
andtoBeFalsy
. We should not use them because they make tests weaker and produce false-positive results.For example,
expect(someBoolean).toBeFalsy()
passes whensomeBoolean === null
, and whensomeBoolean === false
.
What does this MR do and why?
- Add rule to restrict usage of
toBeFalsy
andtoBeTruthy
inspec/frontend/.eslintrc.yml