I'm working on a large js application which is mostly written using Backbone/Marionette. Right now I am using Grunt with an array that has the correct order along with uglify to minify the JS files. This setup is working mostly fine. A bit tedious having to figure out the correct order of files, but I manage. My goal is to introduce automated testing of the application. considering how much cross referencing I have and dependency on the global namespace to access object instances, I thought it would first make sense to modularize the code ( using require.js ) I know this can be a tough refactor but I'm wondering how important this is, if I want to start using some testing libraries to test the code.