Why is DOM-Centric JavaScript Hard to Test?

Posted by Shawn Wildermuth on Feb 07, 2014 on 6:55AM

A lens from microscope used in medical laboratoryWhile producing my recent course on Large Scale JavaScript, I was digging into the testability of JavaScript. So much of the JavaScript I see out there continues to be jQuery driven, DOM-centric JavaScript.

Sure, many of my readers are moving towards AngularJS, Ember and other client-side libraries that encourage modularization, testability, and separation of concerns, but not all web developers are. Ultimately we need to test our JavaScript no matter what the nature of it is.

In this video excerpt from my course, I discuss why DOM-Centric JavaScript is so difficult to test:

Do you agree?

Application Name WilderBlog Environment Name Production
Application Ver Runtime Framework .NETCoreApp,Version=v1.0
App Path D:\home\site\wwwroot Runtime Version .NET Core
Operating System Microsoft Windows 6.2.9200 Runtime Arch X86