From f2c9213e3ea22ee36418924a6c0db7dc87e6e2b3 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Mon, 23 Jan 2023 14:09:10 -0500 Subject: [PATCH] Fix task cancel test being flaky due to task spawn scheduling --- src/tests/task/cancel.luau | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tests/task/cancel.luau b/src/tests/task/cancel.luau index b7df673..e81e441 100644 --- a/src/tests/task/cancel.luau +++ b/src/tests/task/cancel.luau @@ -16,8 +16,10 @@ assert(not flag, "Cancel should handle non-immediate threads") local flag2: number = 1 task.spawn(function() + task.wait(0.1) flag2 = 2 - task.wait() + task.wait(0.2) flag2 = 3 end) +task.wait(0.2) assert(flag2 == 2, "Cancel should properly handle yielding threads")