Skip to content

feat(jest): restrict usage of toBeTruthy or toBeFalsy

Context

In frontend testing guide:

Avoid using toBeTruthy or toBeFalsy

Jest also provides following matchers: toBeTruthy and toBeFalsy. We should not use them because they make tests weaker and produce false-positive results.

For example, expect(someBoolean).toBeFalsy() passes when someBoolean === null, and when someBoolean === false.

What does this MR do and why?

  • Add rule to restrict usage of toBeFalsy and toBeTruthy in spec/frontend/.eslintrc.yml

Merge request reports