ktorio / ktor

Framework for quickly creating connected applications in Kotlin with minimal effort
https://ktor.io
Apache License 2.0
12.86k stars 1.04k forks source link

Change kotlinx-coroutines-test dependency to API #4085

Closed KirpichenkovPavel closed 3 months ago

KirpichenkovPavel commented 3 months ago

Subsystem N/A

Motivation K2 IDE quality gates for multiplatform project

Solution The TestResult class from kotlinx-coroutines-test is used as the return type in the testSuspend function from the ktor-test-dispatcher:commonMain. So the library is an API dependency for the module. Changing implementation dependency to api fixes the K2 MISSING_DEPENDENCY_CLASS diagnostics in common tests, which were false negatives in the K1. Example: io.ktor.utils.io.ByteChannelTest.

CLI compilations don't report the error: there are no compilations for common test source sets that would've missed the dependency. Platform test compilations use the actual versions, which are type aliases with RHS types from stdlib. Stdlib is an implicit dependency, so there's no error either.

See KT-68589

e5l commented 3 months ago

Hey @KirpichenkovPavel, thanks for the PR. LGTM