File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
src/jsTest/kotlin/dev/gitlive/firebase/database Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -70,15 +70,15 @@ kotlin {
70
70
useCommonJs()
71
71
nodejs {
72
72
testTask {
73
- useMocha {
74
- timeout = " 5s "
73
+ useKarma {
74
+ useChromeHeadless()
75
75
}
76
76
}
77
77
}
78
78
browser {
79
79
testTask {
80
- useMocha {
81
- timeout = " 5s "
80
+ useKarma {
81
+ useChromeHeadless()
82
82
}
83
83
}
84
84
}
Original file line number Diff line number Diff line change @@ -10,16 +10,13 @@ import kotlinx.coroutines.withContext
10
10
import kotlinx.coroutines.withTimeout
11
11
import kotlin.time.Duration.Companion.seconds
12
12
13
- actual val emulatorHost: String = " 127.0.0.1" // in JS connection is refused if we use localhost
13
+ actual val emulatorHost: String = " 127.0.0.1" // in JS tests connection is refused if we use localhost
14
14
15
15
actual val context: Any = Unit
16
16
actual fun runTest (test : suspend () -> Unit ) = kotlinx.coroutines.test.runTest {
17
- val db = getDatabase()
18
- goOnline(db)
17
+ // in JS tests we need to wait for the database to be connected
19
18
awaitDatabaseConnection()
20
19
test()
21
- // in JS tests are running infinitely without going database offline
22
- goOffline(db)
23
20
}
24
21
25
22
private suspend fun awaitDatabaseConnection () = withContext(Dispatchers .Default ) {
You can’t perform that action at this time.
0 commit comments