📝 Disallow using expect outside of it or test blocks.
💼recommended config. This rule warns in the 🌐 all config.
This rule aims to prevent the use of expect outside of it or test blocks.
| Name | Description | Type |
|---|---|---|
additionalTestBlockFunctions |
Additional functions that should be treated as test blocks. | String[] |
{
"vitest/no-standalone-expect": [
"error",
{
"additionalTestBlockFunctions": ["test"]
}
]
}example:
// invalid
expect(1).toBe(1)
// valid
it('should be 1', () => {
expect(1).toBe(1)
})