no-confusing-set-timeout
Configuration
rslint.config.ts
Rule Details
Disallow confusing usages of jest.setTimeout. In a single test file Jest applies only the last jest.setTimeout call that runs before any tests execute; later calls and calls inside suites or cases do not change the timeout the way many authors expect. This rule flags patterns that look file- or suite-specific but are misleading.
rslint walks each Jest API call site (including jest imported from @jest/globals and renamed bindings such as Jest.setTimeout). For every jest.setTimeout call it may report:
globalSetTimeout: the call is not at module/global top level (for example inside adescribe/test/itcallback, abeforeEachbody, a block statement, or a class).orderSetTimeout: another Jest API (describe,test,it, hooks,expect, and so on) appears earlier in the same file.multipleSetTimeouts:jest.setTimeoutis invoked more than once in the file (only the last pre-test call matters to Jest).
Plain setTimeout and window.setTimeout are not checked.
Examples of incorrect code for this rule:
Examples of correct code for this rule: