github-pages-deploy-action/node_modules/eslint-plugin-jest/docs/rules/prefer-to-be-undefined.md
James Ives 01d0dd9282 🎉 3.6.0 Build
2020-09-12 18:19:45 -04:00

688 B

Suggest using toBeUndefined() (prefer-to-be-undefined)

In order to have a better failure message, toBeUndefined() should be used upon asserting expectations on undefined value.

Rule details

This rule triggers a warning if toBe(), toEqual() or toStrictEqual() is used to assert an undefined value.

expect(undefined).toBe(undefined);

This rule is enabled by default.

Default configuration

The following patterns are considered warnings:

expect(undefined).toBe(undefined);

expect(undefined).toEqual(undefined);

expect(undefined).toStrictEqual(undefined);

The following pattern is not warning:

expect(undefined).toBeUndefined();