Skip to content

Commit

Permalink
More timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeda88 committed Sep 26, 2023
1 parent ca18a49 commit 6755ff9
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
package dev.gitlive.firebase

import kotlinx.coroutines.test.runTest
import kotlin.time.Duration.Companion.minutes

actual val context: Any = Unit

actual fun runTest(test: suspend () -> Unit) {
runTest { test() }
runTest(timeout = 5.minutes) { test() }
}

@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
Expand Down
2 changes: 1 addition & 1 deletion firebase-auth/karma.config.d/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config.set({
client: {
mocha: {
timeout: 5000
timeout: 180000
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

package dev.gitlive.firebase.auth

import kotlin.time.Duration.Companion.minutes


actual val emulatorHost: String = "localhost"

actual val context: Any = Unit

actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest { test() }
actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest(timeout = 5.minutes) { test() }

@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
actual annotation class IgnoreForAndroidUnitTest
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package dev.gitlive.firebase.remoteconfig

import kotlin.time.Duration.Companion.minutes


actual val context: Any = Unit

actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest { test() }
actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest(timeout = 5.minutes) { test() }

@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
actual annotation class IgnoreForAndroidUnitTest
2 changes: 1 addition & 1 deletion firebase-database/karma.config.d/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config.set({
client: {
mocha: {
timeout: 5000
timeout: 180000
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.withContext
import kotlinx.coroutines.withTimeout
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds

actual val emulatorHost: String = "127.0.0.1" // in JS tests connection is refused if we use localhost

actual val context: Any = Unit
actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest {
actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest(timeout = 5.minutes) {
// in JS tests we need to wait for the database to be connected
awaitDatabaseConnection()
test()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import dev.gitlive.firebase.apps
import dev.gitlive.firebase.initialize
import kotlinx.coroutines.CoroutineScope
import kotlin.test.*
import kotlin.time.Duration.Companion.minutes

actual val emulatorHost: String = "localhost"

actual val context: Any = Unit

actual fun runTest(test: suspend CoroutineScope.() -> Unit) = kotlinx.coroutines.test.runTest { test() }
actual fun runTest(test: suspend CoroutineScope.() -> Unit) = kotlinx.coroutines.test.runTest(timeout = 5.minutes) { test() }

@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
actual annotation class IgnoreForAndroidUnitTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
package dev.gitlive.firebase.storage

import kotlinx.coroutines.CoroutineScope
import kotlin.time.Duration.Companion.minutes

actual val emulatorHost: String = "127.0.0.1"

actual val context: Any = Unit

actual fun runTest(test: suspend CoroutineScope.() -> Unit) {
kotlinx.coroutines.test.runTest { test() }
kotlinx.coroutines.test.runTest(timeout = 5.minutes) { test() }
}

@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
Expand Down

0 comments on commit 6755ff9

Please sign in to comment.