jest/no-confusing-set-timeout
eslint-plugin-jest
No autofix
eslint.config.js
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/no-confusing-set-timeout": "error",
},
},
];describe('test foo', () => {
jest.setTimeout(1000);
it('test-description', () => {
// test logic;
});
});
describe('test bar', () => {
it('test-description', () => {
jest.setTimeout(1000);
// test logic;
});
});
test('foo-bar', () => {
jest.setTimeout(1000);
});
describe('unit test', () => {
beforeEach(() => {
jest.setTimeout(1000);
});
});jest.setTimeout(500);
test('test test', () => {
// do some stuff
});jest.setTimeout(1000);
describe('test bar bar', () => {
it('test-description', () => {
// test logic;
});
});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/no-confusing-set-timeout
eslint-plugin-jest
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/no-confusing-set-timeout": "error",
},
},
];jest/no-confusing-set-timeout
jest plugin · style
{
"plugins": [
"jest"
],
"rules": {
"jest/no-confusing-set-timeout": "error"
}
}Biome does not have this rule.
Enforces a maximum number assertion calls in a test body
Disallow unnecessary async function wrapper for expected promises