https://kotlinlang.org logo
#ktor
Title
# ktor
j

Jonas Bark

06/28/2019, 1:27 PM
I've got the following gradle configuration:
Copy code
js().compilations["main"].defaultSourceSet {
            dependencies {
                implementation("org.jetbrains.kotlin:kotlin-stdlib-js")
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Libs.coroutines_version}")
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:${Libs.serialization_version}")
                implementation("io.ktor:ktor-client-js:${Libs.ktor_version}")
                implementation("io.ktor:ktor-client-json-js:${Libs.ktor_version}")
                implementation("io.ktor:ktor-client-serialization-js:${Libs.ktor_version}")
                implementation("io.ktor:ktor-client-logging-js:${Libs.ktor_version}")
            }
        }
        js().compilations["test"].defaultSourceSet {
            dependencies {
                implementation("org.jetbrains.kotlin:kotlin-test-js")
                implementation("io.mockk:mockk:${Libs.mockk_version}")
            }
        }
        js {
            browser {
                testTask {
                    useKarma {
                        useChromeHeadless()
                    }
                }
            }
        }
when trying to run the jsTest task I'm getting errors that e.g. utf-8-validate is missing:
Copy code
Module not found: Error: Can't resolve 'utf-8-validate'
 @ .._imported/ktor-ktor-client-core/1.2.2/ktor-ktor-client-core.js
I'm using latest ktor 1.2.2. Want me to open an issue? It seems it's related to ktor.
📝 1
adding
implementation(npm("text-encoding"))
solved the error 🙂
now there are only warnings with utf-8-validate but the tests work