vitest/prefer-to-be-falsy

January 2, 2026 ยท View on GitHub

๐Ÿ“ Enforce using toBeFalsy().

๐Ÿšซ This rule is disabled in the ๐ŸŒ all config.

๐Ÿ”ง This rule is automatically fixable by the --fix CLI option.

Rule Details

This rule aims to enforce the use of toBeFalsy() over toBe(false)

Examples of incorrect code for this rule:

expect(foo).toBe(false)
expectTypeOf(foo).toBe(false)

Examples of correct code for this rule:

expect(foo).toBeFalsy()
expectTypeOf(foo).toBeFalsy()