I am just trying to add wasmJs to one of my multi-...
# webassembly
m
I am just trying to add wasmJs to one of my multi-platform libraries but that breaks my tests because some tests read some reference values from a large binary file via kotlinx-io. But file IO does not seem to be supported for wasmJs which is somehow understandable because the browser does not have a concept of a file system but what other possibility do you have to get this test data into your tests?
i
Hi, the
kotlinx-io
does support
wasmJs
target, as far as I know just like
kotlin-js
do. As far as i remember it use
nodejs
API for that.
m
But when I run my test on wasmJs I only get a:
Copy code
UnsupportedOperationException: Module os could not be loaded
UnsupportedOperationException: Module os could not be loaded
	at kotlin.captureStackTrace(/var/folders/0q/r4k4hbd13_s0p0thlz2hs8b80000gn/T/_karma_webpack_930887/commons.js:133)
	at <de.mpmediasoft.mpcore.gis:gis_test>.kotlin.captureStackTrace__externalAdapter(<http://localhost:9876/ktlibs-gis-wasm-js-test.wasm>)
	at <de.mpmediasoft.mpcore.gis:gis_test>.kotlin.Throwable.<init>(<http://localhost:9876/ktlibs-gis-wasm-js-test.wasm>)
	at <de.mpmediasoft.mpcore.gis:gis_test>.kotlin.Throwable.<init>(<http://localhost:9876/ktlibs-gis-wasm-js-test.wasm>)
	at <de.mpmediasoft.mpcore.gis:gis_test>.kotlin.Exception.<init>(<http://localhost:9876/ktlibs-gis-wasm-js-test.wasm>)
	at <de.mpmediasoft.mpcore.gis:gis_test>.kotlin.RuntimeException.<init>(<http://localhost:9876/ktlibs-gis-wasm-js-test.wasm>)
	at <de.mpmediasoft.mpcore.gis:gis_test>.kotlin.UnsupportedOperationException.<init>(<http://localhost:9876/ktlibs-gis-wasm-js-test.wasm>)
	at <de.mpmediasoft.mpcore.gis:gis_test>.kotlinx.io.node.loadModule(<http://localhost:9876/ktlibs-gis-wasm-js-test.wasm>)
	at lambda.invoke(<http://localhost:9876/ktlibs-gis-wasm-js-test.wasm>)
	at lambda.invoke(<http://localhost:9876/ktlibs-gis-wasm-js-test.wasm>)
On all other targets (Android, JVM, iOS) this test it running nicely. Other tests, which don’t try to do any IO, are working on wasmJs too.