vitest/no-alias-methods

January 2, 2026 ยท View on GitHub

๐Ÿ“ Disallow alias methods.

โš ๏ธ This rule warns in the ๐ŸŒ all config.

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

Rule Details

This rule disallows alias methods and forces the use of the original method.

Examples of incorrect code for this rule:

expect(a).toBeCalled()
expect(a).toBeCalledTimes(1)

Examples of correct code for this rule:

expect(a).toHaveBeenCalled()
expect(a).toHaveBeenCalledTimes(1)

When Not To Use It

If you don't care about alias methods, you can disable this rule.