Hi all, Im working on a larger project utilizing k...
# multiplatform
k
Hi all, Im working on a larger project utilizing kotlin multiplatform. We have recently started an upgrade from the older plugins to the kotlin.multiplatform plugin, but we have run into a bit of a problem. Im hoping someone here can shed some light on what we are doing wrong. The problem is essentiallly that we would like to run the testcases on all our target platforms, and we have it running on all targets, except js, which sadly is the most important atm. I created a sample repository that demonstrates the problem: https://github.com/jayway/kotlin-multiplatform-js-tests-debug If you build that repository, you get an error when it tries to run the common testcases in js (it works in jvm). Does anybody have a solution? Thanks!
b
@Ilya Goncharov [JB] could you please take a look?
@Kenneth Andersson try to comment
outputFile = "$project.buildDir.path/js/${project.name}.js"
https://github.com/jayway/kotlin-multiplatform-js-tests-debug/blob/master/common/build.gradle#L13
And please file an issue with your example https://kotl.in/issue
k
Thanks Zalim. I will be sure to file an issue on the problem. And I can confirm that if I remove outputFile it works as expected. Do you know if there is any other way to control the output name? I have several multiplatform modules, some depending on eachother, and the root project name is prepended to the module name…
i
@Kenneth Andersson Now browser tests require hardcoded file
kotlin/name.js
It is not ideal beahviour, that’s true, for example for
jsBrowserTest
we get file as entry point with other strategy, does it work for you? As for changing name, there is issue, that you can find useful https://youtrack.jetbrains.com/issue/KT-34252 And of course feel free to submit issues with your own problem and describe your use case As WA I can recommend you watch on configuring Karma (test runner for browser testing), you can create
karma.config.d
folder in your module And add plain js file to this folder, where you can configure karma as you want, it is a bit unsafe, but absolutely flexible You can add something like
Copy code
const path = require("path")
config.set({
files: [path.resolve(__dirname, <path-to-your-file-relative-to-'build/js/packages/package-name-test'>)]
})
Basically it can help you, but if you will any problems, please let me know
k
Okay, thanks. I will see what I can do there. I dont have to run the testcases in the browser really, so I did change that part to the nodejs runner - that doesnt work with outputFile either tho
Right now I will probably modify the generated js-files with sed to get what I want - even if that is very far from optimal