Skip to content
kerfjsGitHub

Diagnostics

T004

Sleeps, real timers or waitFor polling in a test.

Fix: await flush(); for time, clock.install() and await clock.advance(ms) from @kerf-js/core/test.

Status in kerf@0.1.0: reported by kerf check on test files.

Triggers it:

tsx
test('later', async () => { await new Promise(r => setTimeout(r, 100)); expect(1 + 1).toBe(2) })

A test that needs it on purpose keeps it with a reason: // kerf-allow T004: <why> in the file header (whole file) or on the line above.

More: kerf docs testing.