Skip to content
weftGitHub

Diagnostics

T004

Sleeps, real timers or waitFor polling in a test.

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

Status in weft@0.1.0: reported by weft 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: // weft-allow T004: <why> in the file header (whole file) or on the line above.

More: weft docs testing.