Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficult to debug fatal error when expectation is called after a test completes #500

Closed
stephencelis opened this issue Jun 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@stephencelis
Copy link

stephencelis commented Jun 24, 2024

Description

If you are testing code that runs in a Task and forget to wait for it to finish, Swift Testing currently crashes.

Expected behavior

Ideally, Swift Testing wouldn't crash, and would instead emit a test failure or some other friendlier diagnostic.

Actual behavior

Swift Testing crashes with the message:

❌ Fatal error: Internal inconsistency: No test reporter for test case argumentIDs: Optional([])

Steps to reproduce

@Test func task() async {
  let task = Task {
    #expect(1 == 2)
  }
  // await task.value  // Comment in for a passing test
}

swift-testing version/commit hash

Testing Library Version: 75.7 (arm64e-apple-macos13.0) (Xcode 16 beta 1)

Swift & OS version (output of swift --version ; uname -a)

swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
Target: arm64-apple-macosx14.0
Darwin Stephens-M2-Pro.lan 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64

@stephencelis stephencelis added the bug Something isn't working label Jun 24, 2024
@grynspan
Copy link
Contributor

Duplicate of #480

@grynspan grynspan marked this as a duplicate of #480 Jun 25, 2024
@grynspan grynspan closed this as not planned Won't fix, can't repro, duplicate, stale Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants