Introduction to JavaScript testing
A couple of years ago, JavaScript testing was really obfuscated because no one used to care about testing front-end websites. HTML and CSS were not tested – no one even thought to test it – and JavaScript testing was strange to see. One of the main problems was that a lot of developers were coming from Java, where JUnit introduced everything needed to test an application – a test runner, a library to write the tests, an assertion library – and no equivalents existed for JavaScript.
We had to install three libraries to do something similar for JUnit. That meant that we had to learn how these three libraries worked, and of course there were situations where testing some edge cases was impossible due to incompatibility between libraries.
Let's start understanding how testing now works in JavaScript.
Types of tests
To understand how testing works a bit more and what types of testing exist, I'll try to...