Michael Paus
10/05/2024, 5:13 PMError: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
1. Does anybody know where this output line is coming from and what it is trying to tell me?
2. What is the correct HttpClientEngineFactory for wasmJs? I am currently trying io.ktor.client.engine.js.Js
.
3. Is there anything special to configure for wasmJs?Michael Paus
10/05/2024, 6:02 PMOliver.O
10/05/2024, 6:04 PMMichael Paus
10/05/2024, 6:41 PMimplementation(kotlin("test"))
Oliver.O
10/05/2024, 6:46 PMjw
10/05/2024, 7:03 PMjw
10/05/2024, 7:03 PMjw
10/05/2024, 7:10 PMOliver.O
10/05/2024, 7:33 PMWhy should an assertion library be concerned about a runner's timeout?It's not the assertion library but the framework, which actually runs multiplatform tests. The framework has its own cross-platform timeout configurations. The JS "runner" is just an implementation detail on one platform and should not interfere with the framework user's decision on test timeouts, which might have been set in common code.
jw
10/05/2024, 8:32 PMOliver.O
10/05/2024, 8:36 PMjw
10/05/2024, 8:39 PMOliver.O
10/05/2024, 8:44 PMMichael Paus
10/05/2024, 9:51 PMjs {
nodejs {
testTask {
useMocha {
timeout = "5s"
}
}
}
}
to my build script as shown in the linked example but that only results in an endless list of configuration error messages which brings me back to my original questions points 2 and 3. Is this actually supposed to work for wasmJs?jw
10/05/2024, 9:56 PMjw
10/05/2024, 9:57 PMMichael Paus
10/05/2024, 10:03 PM@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
wasmJs {
browser()
binaries.library()
nodejs {
testTask {
useMocha {
timeout = "5s"
}
}
}
}
This works in so far now as the test gets compiled and runs but its output is still:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
Jilles van Gurp
10/07/2024, 11:58 AMMichael Paus
10/07/2024, 1:14 PMval httpClient = HttpClient(engineFactory) {
install(HttpTimeout) {
requestTimeoutMillis = 30_000
connectTimeoutMillis = 5_000
}
install(HttpRequestRetry) {
retryOnServerErrors(maxRetries = 5)
constantDelay()
}
install(ContentEncoding) {
deflate(1.0F)
gzip(0.9F)
}
followRedirects = true // This is the default anyway.
}
The above shown timeout setting for Mocha just doesn’t seem to have any effect. I actually ran this code from the wasmJs application and did not get such a timeout. But that did not help me much either because what I wanted to do just resulted in a CORS error. In the end it turns out that what I wanted to do is just not possible with a web-app, so I’ll have to stick to writing desktop apps 😢.