jest/no-alias-methods
eslint-plugin-jest
Safe autofixRecommended
eslint.config.js
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/no-alias-methods": "error",
},
},
];expect(a).toBeCalled()
expect(a).toBeCalledTimes()
expect(a).toBeCalledWith()
expect(a).lastCalledWith()
expect(a).nthCalledWith()
expect(a).toReturn()
expect(a).toReturnTimes()
expect(a).toReturnWith()
expect(a).lastReturnedWith()
expect(a).nthReturnedWith()
expect(a).toThrowError()expect(a).toHaveBeenCalled()
expect(a).toHaveBeenCalledTimes()
expect(a).toHaveBeenCalledWith()
expect(a).toHaveBeenLastCalledWith()
expect(a).toHaveBeenNthCalledWith()
expect(a).toHaveReturned()
expect(a).toHaveReturnedTimes()
expect(a).toHaveReturnedWith()
expect(a).toHaveLastReturnedWith()
expect(a).toHaveNthReturnedWith()
expect(a).toThrow()Examples from the Oxlint documentation.
jest/no-alias-methods
eslint-plugin-jest
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/no-alias-methods": "error",
},
},
];jest/no-alias-methods
jest plugin · style
{
"plugins": [
"jest"
],
"rules": {
"jest/no-alias-methods": "error"
}
}Biome does not have this rule.
Disallow using expect outside of it or test blocks
Disallow use of deprecated functions