I've been using Karma, Mocha and Chai for UnitTesting our client side environment at HPE Yehud, Israel where we develop the Mobile Center product.
Karma is an excellent unittest runner, and at the beginning we used the PhantomJS plugin to be used as our headless browser, but, some time ago, we started to write ES6 (ECMAScript 6) code.
As the new standards came, also arrived the inability for some browsers to support those new standards, and Phantom wasn't different.
We had two possibilities, use Babel as a plugin for our karma runner to transpile our code-to-test, or, use another headless browser that supports ES6 standards. Of course, we opted for the second option despite all the objections and defiance of the colleagues.
This is when I came across electron which it is an excellent framework for building cross platform desktop applications. In our case, we used it only as a plugin for our headless browser in our Karma configuration file.
So, here is how our karma config file looks like:
Now, the important part here is the browser property and the electronOpts property where we define to run our unittest with electron and it will be hidden, so it won't bother our jenkins when building our drops.
Conclusion: We decided to use a browser that supports ES6, since otherwise it was like saying that when writing unittests for your server side C# code, you need to test not your code but the IL (intermediate language) code that .NET compiles in.
Conclusion: We decided to use a browser that supports ES6, since otherwise it was like saying that when writing unittests for your server side C# code, you need to test not your code but the IL (intermediate language) code that .NET compiles in.
You are invited to leave your comments or questions.