When running some async unit tests, we sometimes see some errors spit out that don't fail our build. Examples look like:
Internal inconsistency error (didStartTask): targetID (174) not found in _activeTargets. Internal inconsistency error (didEndTask): '12' missing from _activeTasks.
I'm not sure if this is a Swift runtime error. The "internal inconsistency" seems to hint at a Swift-level bug rather than a mistake in my code, but I'm not certain and don't want to write it off too quickly. It started showing up when I added unit tests that spawn their own Tasks and then use
waitForExpectations to wait for them to complete. Inside of a unit test, do we need to do anything special to manage Tasks that might still be running when the test fails? Do we need to make sure to cancel them all? Is it safe to cancel ones that completed successfully?