megaYield(count:)

Suspends the current task a number of times before resuming with the goal of allowing other tasks to start their work.

Task.swift:11
static func megaYield(count: Int = _defaultMegaYieldCount) async

This function can be used to make flakey async tests less flakey, as described in this Swift Forums post. You may, however, prefer to use withMainSerialExecutor(operation:)-79jpc to improve the reliability of async tests, and to make their execution deterministic.