Is there a way to do sw testing which doesn't requ...
# javascript
n
Is there a way to do sw testing which doesn't require the use of npm/node?
g
But how you would run js code without node?
n
g
Internal one? What do you mean?
☝️ 1
Sounds like a good idea for a plugin actually. Because it’s good to test your code for particular browser
But webserver and browser are cxompletely different things. [sorry, misunderstand you] To run js you need browser with JS engine, and there is no such thing in Idea (you can use some thing like Nashorn for that, but it’s similar to node, it’s not a browser).
Okay, I probably got your point. To run webserver, open browser, run tests and pass them back to IDE? I thought that you are talking about internal browser. Yeah, that the same thing that I meant, that would be nice to have such plugin, it’s useful not only because it “node.js less solution”. But not sure how should this work with command line launcher
n
Actually I was thinking of having the test results presented in the web browser.
g
Yes, of course, but integration with IDE would be a good option too, for example you can run same test suite in different browsers in parallel and Idea will show all the results
n
IDE integration is important but there should always be the option for a Kotliner to use whatever dev tool (IDE/code editor) they prefer. Gradle integration is also important for automating the testing process, unfortunately the Gradle test task is tightly coupled to the JUnit test runner which isn't multi-platform friendly 🙍.
g
Yeah, sounds reasonable. JUnit 5 test runner framework probably can help with integration
n
Both Kotlin test frameworks (Spek and Kotlin Test) have tight integration with JUnit 5 which is causing problems. Most notably neither can be used with Android. Since JUnit is JVM only Kotlin JS support isn't an option unfortunately.
g
But in this case you don’t need integration with Android
You still need some code that allow to run tests and collect results. And Gradle already uses JVM
n
For Kotlin JS testing only that is true.
g
And JUnit 5 test runner provides API for custom tests, so you don’t need to write test reports and many other things also, you will get IDE and Gradle integration (maybe not now, but in the future)
of course, you still need some kotlin js part to integrate with js testing framework (or maybe even own framework), but it’s much easier to write only this part and reuse gradle and ide integration from JUnit
actually easiest implementation. Just a gradle task that generates html with kotlin.js and your code and your test suite and opens it in a browser