Ensure System Tests Fail When JavaScript Is Broken
Explore how to effectively test JavaScript within Rails applications by ensuring system tests fail when JavaScript is broken. Understand the limits of unit testing JavaScript, the trade-offs of different testing environments, and why system tests that run in the browser are crucial for maintaining reliability in your app.
We'll cover the following...
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 ...