Skip to content
← All rules
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.

timingsynchronizationflakiness
TypeScript
await delay(500); expect(job.done).toBe(true);
Finding

Disallow sleeps used to synchronize tests.

Setup

Install the package, register its plugin factory, then enable the rule.

Install the package

pnpm add -D @scruple/tests

Register 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

Released under the MIT License.