jest/require-top-level-describe
eslint-plugin-jest
No autofix
eslint.config.js
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/require-top-level-describe": "error",
},
},
];Require test cases and hooks to be inside a describe block
describe('test suite', () => {
it('test', () => {});
});
describe('test suite', () => {});
describe('test suite', () => {});The documentation shows no correct example for this rule.
Examples from the ESLint documentation.
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/require-top-level-describe
eslint-plugin-jest
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/require-top-level-describe": "error",
},
},
];jest/require-top-level-describe
jest plugin · style
{
"plugins": [
"jest"
],
"rules": {
"jest/require-top-level-describe": "error"
}
}nursery/useTopLevelDescribe
nursery · since 2.6.9
{
"linter": {
"rules": {
"nursery": {
"useTopLevelDescribe": "error"
}
}
}
}Enforce that all tests are in a top-level describe
Suggest using toHaveBeenCalledTimes()