vitest/expect-expect
@vitest/eslint-plugin
No autofixRecommended
eslint.config.js
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/expect-expect": "error",
},
},
];test('myLogic', () => {
console.log('myLogic')
})
test('myLogic', () => {})test('myLogic', () => {
const actual = myLogic()
expect(actual).toBe(true)
})Examples from the ESLint documentation.
vitest/expect-expect
@vitest/eslint-plugin
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/expect-expect": "error",
},
},
];vitest/expect-expect
vitest plugin · correctness
{
"plugins": [
"vitest"
],
"rules": {
"vitest/expect-expect": "error"
}
}suspicious/useExpect
suspicious · since 2.4.2
{
"linter": {
"rules": {
"suspicious": {
"useExpect": "error"
}
}
}
}Enforce assertion to be made in a test body
Disallow using expect outside of it or test blocks