vitest/prefer-to-have-length
January 2, 2026 ยท View on GitHub
๐ Enforce using toHaveLength().
โ ๏ธ This rule warns in the ๐ all config.
๐ง This rule is automatically fixable by the --fix CLI option.
// bad
expect(files.length).toStrictEqual(1)
// good
expect(files).toHaveLength(1)