jeudi 20 avril 2017

Advice needed for unit testing JS website

I'm after some advice about how to integrate unit testing into a project I've been asked to work on.

The project is a large website/web app which is predominately written in Java. I don't touch that side, and I'm not interested in testing the Java. However, I will be working with JSP files, as well as CSS and JS. It's the JavaScript that I most want to test.

At the moment, in order to see my code running I have to spin up a Tomcat Apache server which then allows me to access localhost and see the JSP output.

My previous experience of testing is React based and I've used Mocha, Karma, Webpack and the Chai library to make assertions and test the JS. I've spent hours trying to wrangle this setup in place but it seems pretty clear now that it's not suitable, or at least not in the way I've been approaching it.

Could anyone point me in the right direction? There are a few hundred JS files which I'd like to get unit tests written for eventually and at some point having integration tests would be nice too. Unit for the time being is the priority though. I'm trying to move this towards TDD.

If you need any further environment information just let me know. I feel like there must be something pretty obvious that I'm missing somewhere!

Aucun commentaire:

Enregistrer un commentaire