Skip to content

No task.wait

ErrorRoblox
small-rules/no-task-wait

Disallow task.wait() and Promise.delay(...).await() calls.

Rationale

Our unit tests were taking ten billion years to run because of task.wait() calls scattered everywhere, each one actually sleeping. Promise.delay(...).await() does the same thing. Absolute nonsense in a test suite.

Advance your scheduler or wait for the actual condition instead of sleeping and hoping. The game code can use it fine, this is really about keeping the test run from dragging.

Diagnostic Messages

noPromiseDelayAwait
Do not use Promise.delay(...).await() in tests. Advance deterministic schedulers or wait for the actual condition instead.
noTaskWait
Do not use task.wait() in tests. Advance deterministic schedulers or wait for the actual condition instead.

Configuration

This rule does not accept options.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/no-task-wait": "error"
}
}

Examples

direct task.wait call
task.wait();
delayed task callback
task.delay(1, callback);