hfhbd
08/16/2021, 9:59 AMError: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
happens with my runTest
implementation using JS IR:
val testScope = MainScope()
fun runTest(block: suspend CoroutineScope.() -> Unit): dynamic = testScope.promise { block() }
Pitel
08/16/2021, 12:47 PMRegex
object, it doesn not match. Is there some workaround?Didier Villevalois
08/16/2021, 12:58 PMzeromq.js
with
implementation(npm("zeromq", "6.0.0-beta.6", generateExternals = true))
but I get some problems with the generated KT sources.
Apart from some problems with some type parameters, Buffer
(a node class) seems to not being correctly linked to Node declarations. Namely, I get a:
Unresolved reference: Buffer
Is there something I am not doing right? Or is there a workaround for this, or a simple PR that I could contribute to Dukat?CLOVIS
08/16/2021, 2:54 PM[webpack-cli] Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property '_assetEmittingWrittenFiles'. These properties are valid:
object { bonjour?, client?, compress?, dev?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, public?, setupExitSignals?, static?, transportMode?, watchFiles? }
I don't know where this comes from. I can't even run the code from a week ago, which is definitely correct.Robert Jaros
08/16/2021, 3:07 PMDidier Villevalois
08/16/2021, 3:56 PMBuffer
to a Kotlin ByteArray
, and vice-versa ?Didier Villevalois
08/16/2021, 11:49 PMGlobalScope.launch
because there is no runBlocking
in Kotlin/JS. However, assertion errors are not correctly collected and the test doesn't fail when an assertion fails.
@Test
fun testSimple() = GlobalScope.launch {
// ...
}
Rahim Klaber
08/17/2021, 1:06 AMconfig.devServer.disableHostCheck=true
in a webpack config snippet, but It tells me that disableHostCheck is not a valid property. I don't have much experience with webpack but from what I understand what I did should work.kk57
08/17/2021, 9:43 AMCLOVIS
08/17/2021, 4:08 PMByteArray
that contains the binary data of an image (image/png
).
I'm trying to display that image to the user.
So far I have:
val blob = Blob(arrayOf(data), BlobPropertyBag(
type = "image/png",
))
val url = URL.createObjectURL(blob)
window.open(url, target = "_blank", features = "noopener,noreferrer")
However, running the code opens a tab with a small grey square, no matter the original image. I think the blob conversion is the culprit, but I'm honestly not sure. Because Blob
takes an Array<dynamic>
, I have no meaningful way of knowing what's wrong with it.Tianyu Zhu
08/17/2021, 9:31 PMaltavir
08/18/2021, 7:52 AM> [webpack-cli] Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property '_assetEmittingPreviousFiles'. These properties are valid:
object { bonjour?, client?, compress?, dev?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, public?, setupExitSignals?, static?, transportMode?, watchFiles? }
error in webpack run tasks. I am not sure what changed. Does anybody else have the promblem?Marius Ailinca
08/18/2021, 8:17 AMMarius Ailinca
08/18/2021, 8:24 AMCLOVIS
08/18/2021, 9:36 AMdevNpm
dependency that has a JS script I'd like to run during development.
So far I've done it by using my locally installed /usr/bin/node, but that's not portable (especially for CI); I'd like to take advantage of Kotlin's Node installation.CLOVIS
08/18/2021, 11:02 AMbsimmons
08/18/2021, 11:51 AM/** Convert promise with HTTP 500 response to failed promise. */
fun Promise<Response>.handleErrorCodes(): Promise<Response> = then { response ->
if(response.ok) response
else response.text().then { body ->
throw RuntimeException("${response.status}: $body")
}
}.then { it as Response }
kpgalligan
08/18/2021, 3:57 PMMarius Ailinca
08/19/2021, 8:29 AMvar map = new H.Map(
{
center: {lat: 40.745390, lng: -74.022917},
zoom: 13.2
});
center is not properly initialized. I tried defining an interface for center (IPoint) and pass an object:IPoint to the constructor but it doesn't work. Tried to implement the interface in a class and still doesn't work. How to I pass a json anonymous object from kotlin to js? Thank you!Nikolai Sviridov
08/19/2021, 6:36 PMhttp://127.0.0.1:5500/my_file.png▾
allanhasegawa
08/20/2021, 1:01 PMDra
08/21/2021, 5:35 PMval prompt get() = document.querySelector(".prompt-box")!!
When I run the page "normally" it works I can use the things how I want but when I try to run my test I always get this stacktrace :
NullPointerException
at Object.captureStack(/tmp/_karma_webpack_318847/commons.js:40068)
at NullPointerException.constructor(/tmp/_karma_webpack_318847/commons.js:40401)
at NullPointerException.constructor(/tmp/_karma_webpack_318847/commons.js:40427)
at RuntimeException.init(/tmp/_karma_webpack_318847/commons.js:40438)
at <global>.new NullPointerException(/tmp/_karma_webpack_318847/commons.js:40547)
at Object.throwNPE(/tmp/_karma_webpack_318847/commons.js:44251)
at Kotlin.ensureNotNull(/tmp/_karma_webpack_318847/commons.js:2224)
at Object.get_prompt(/tmp/_karma_webpack_318847/commons.js:66566)
at TestClient.testAddCharToOperation(/tmp/_karma_webpack_318847/commons.js:66475)
at <global>.<unknown>(/tmp/_karma_webpack_318847/commons.js:66523)
(The div with a class exists in my HTML)
I tried out some things but I couldn't manage to make the tests work properly... Here's my last try :
@Test
fun testAddCharToOperation() {
val div = document.createElement("div")
div.innerHTML = """<div class="prompt-box">0</div> """
assertEquals("", operation)
assertEquals("0", prompt.textContent)
addCharToOperations('1')
assertEquals("1", operation)
assertEquals("1", prompt.textContent)
}
Tuna
08/22/2021, 5:44 AMsass
to compile.Nikola Milovic
08/23/2021, 9:52 AM<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
Using this as an example, as it has all of the above questions. Classes are from bootstrapPitel
08/23/2021, 12:19 PMval sortDom = document.querySelector("thead th span") as SPAN
sortDom.click() // Why is there no click() method?! It works in browser.
vonox7
08/23/2021, 5:08 PMT
is an Enum? I’m really afraid to write code like T::class.js.toString().contains("Enum.call(this")
, although this works for the legacy compiler (Enum.call(this);
) and for the IR compiler (Enum.call(this, name, ordinal);
)
Question on StackOverflowAyfri
08/23/2021, 7:56 PM@file:JsModule
, how can I declare an non-external interface (an external function return an object without external interface so I created a local interface) ?Ayfri
08/23/2021, 9:46 PMPitel
08/24/2021, 9:24 AMcreateStore(
reducers,
jsObject(),
compose(
rEnhancer()
) {
if (window.asDynamic().__REDUX_DEVTOOLS_EXTENSION__) {
window.asDynamic().__REDUX_DEVTOOLS_EXTENSION__()
} else {
it
}
}
)
Ayfri
08/24/2021, 10:26 PMexport class A<T extends (...args: any[]) => void> {
}
type B = (a: string, b: string, c: string) => void;
export interface C {
foo: A<B>
}
I tried this but it says Type argument is not within its bounds.
:
open external class A<T : (args: Array<out Any>) -> Unit)
typealias B = (a: String, b: String, c: String) -> Unit
external interface C {
var foo: A<B>
}