In order to have a better failure message, toBeUndefined()
should be used upon
asserting expections on undefined value.
This rule triggers a warning if toBe()
is used to assert a undefined value.
expect(undefined).toBe(undefined);
This rule is enabled by default.
The following pattern is considered warning:
expect(undefined).toBe(undefined);
The following pattern is not warning:
expect(undefined).toBeUndefined();