TestsTest reliability
tests/no-fixed-delay-synchronization
Wait for a condition or use fake clocks instead of sleeps, pauses, waitForTimeout, or direct timers to guess when test work is ready.
01 Examples
TypeScript
await delay(500); expect(job.done).toBe(true);Finding
Disallow sleeps used to synchronize tests.
02 Enable it
Setup
Install the package, register its plugin factory, then enable the rule.
Install the package
pnpm add -D @scruple/testsRegister the plugin
In scruple.config.ts, register the factory under the tests namespace used by the rule ID.
import { tests } from "@scruple/tests";
plugins: {
"tests": tests(),
},Enable the rule
"tests/no-fixed-delay-synchronization": "warn"- Package
@scruple/tests- Default threshold
- Plugin default
- Minimum confidence
- Plugin default