damian
10/14/2026, 3:02 PMwasmWasi which depends on WasmImport host functions? In my ideal world, I'd like to be able to run against something like Endive (where I can leverage existing JVM ecosystem libraries to implement those host functions). But as maybe second-best, implement those host functions in some other language to somehow bind in the test environmentjessewilson
10/15/2026, 8:02 AMjessewilson
10/15/2026, 8:03 AMjessewilson
10/15/2026, 8:06 AMjessewilson
10/15/2026, 8:07 AMdamian
10/15/2026, 1:55 PMWasmExport and WasmImport. I will definitely keep an eye on this stuff though.
At the moment, I'm mostly looking for a way to run tests in a pretty vanilla wasmWasi target where I can bind host functions. I suppose I could implement a custom test task to set this up (just run a custom executable that links the wasm executable and runs it with the needed functions) but was hoping there's already some prior art for that.CharlieTap
10/15/2026, 3:21 PMdamian
10/19/2026, 9:53 PMTestEngine with JUnit platform which executes a wasm binary from resources using Endive, and reports results from it (need to parse the ##teamcity[...] events from stdout)
• Create a new compilation and test run for "hosted wasm wasi" test on JVM
• Wire the test compilation output into the resources for this compilation
TL;DR gradle config:
kotlin {
// ...configure wasmWasi...
val moduleName = targets
.named<KotlinWasmWasiTargetDsl>("wasmWasi")
.flatMap { it.compilations.named("test") }
.flatMap { it.outputModuleName }
val outputDir = tasks
.named<KotlinJsIrLink>("compileTestDevelopmentExecutableKotlinWasmWasi")
.flatMap { it.destinationDirectory }
jvm {
val hostedWasmWasiTest = compilations.create("hostedWasmWasiTest")
testRuns.create("hostedWasmWasi") {
setExecutionSourceFrom(hostedWasmWasiTest)
executionTask.configure {
useJUnitPlatform {
includeEngines("hosted-wasm-wasi") // ID of the "hosted wasm-wasi" test engine, implemented in `:my-hosted-testing`
}
systemProperty("hosted.wasm.module-name", moduleName.get()) // allows locating the correct resource by name
targetName = "wasmWasi"
testClassesDirs = compilations.getByName("main").output.classesDirs // ensure test task isn't skipped w/ NO-SOURCE
isScanForTestClasses = false
}
}
}
sourceSets.named("jvmHostedWasmWasiTest").configure {
resources.srcDirs(outputDir)
}
}
dependencies {
add("jvmHostedWasmWasiTestImplementation", testFixtures(project(":my-hosted-testing"))) // implements the `TestEngine`
}