jest/valid-title
eslint-plugin-jest
Safe autofixRecommended
eslint.config.js
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/valid-title": "error",
},
},
];describe('', () => {});
describe('foo', () => {
it('', () => {});
});
it('', () => {});
test('', () => {});
xdescribe('', () => {});
xit('', () => {});
xtest('', () => {});test.each([
[1, 1, 2],
[1, 2, 3],
[2, 1, 3],
])('.add(%I, %I)', (a, b, expected) => {
expect(a + b).toBe(expected);
});it(123, () => {});
describe(String(/.+/), () => {});
describe(myFunction, () => {});
xdescribe(myFunction, () => {});
describe(6, function () {});describe('foo', () => {});
describe('foo', () => {
it('bar', () => {});
});
test('foo', () => {});
it('foo', () => {});
xdescribe('foo', () => {});
xit('foo', () => {});
xtest('foo', () => {});test.each([
[1, 1, 2],
[1, 2, 3],
[2, 1, 3],
])('.add(%i, %i)', (a, b, expected) => {
expect(a + b).toBe(expected);
});it('is a string', () => {});
test('is a string', () => {});
xtest('is a string', () => {});
describe('is a string', () => {});
describe.skip('is a string', () => {});
fdescribe('is a string', () => {});Examples from the ESLint documentation.
jest/valid-title
eslint-plugin-jest
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/valid-title": "error",
},
},
];jest/valid-title
jest plugin · correctness
{
"plugins": [
"jest"
],
"rules": {
"jest/valid-title": "error"
}
}nursery/useValidTestTitle
nursery · since 2.5.14
{
"linter": {
"rules": {
"nursery": {
"useValidTestTitle": "error"
}
}
}
}Disallow using expect outside of it or test blocks
Disallow using a callback in asynchronous tests and hooks