Ensure System Tests Fail When JavaScript Is Broken

Learn what will be the outcome if JavaScript breaks in our Rails application.

Unit testing in JavaScript

We’ll talk further about the deeper value and purpose of testing, but to briefly preview it, testing is a way to mitigate the risk of shipping broken code to production. Because of JavaScript’s unique attributes, it may seem that there is greater value in unit testing JavaScript that is already covered by system tests if that JavaScript is complex.

That said, unit testing JavaScript is not easy. There is no all-in-one testing framework, and setting up JavaScript-based tests requires a lot of decisions, plumbing, and dependencies. It also requires having Node installed in our development environment, which results in testing our JavaScript in an environment that is not the same as that where it runs: Node is a server-side platform, whereas our JavaScript runs in a web browser.

Get hands-on with 1400+ tech skills courses.