jest/prefer-mock-promise-shorthand
eslint-plugin-jest
Safe autofix
eslint.config.js
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/prefer-mock-promise-shorthand": "error",
},
},
];No code example for this rule
The linters' documentation does not include one we could extract.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
jest/prefer-mock-promise-shorthand
eslint-plugin-jest
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/prefer-mock-promise-shorthand": "error",
},
},
];jest/prefer-mock-promise-shorthand
jest plugin · style
{
"plugins": [
"jest"
],
"rules": {
"jest/prefer-mock-promise-shorthand": "error"
}
}Biome does not have this rule.
Enforce mock resolved/rejected shorthands for promises
Prefer await expect(...).resolves over expect(await ...) syntax
Prefer including a hint with external snapshots
Suggest using expect.assertions() OR expect.hasAssertions()