good unit tests framesworks in javascript will throw errors when you leak global variables. it can be massively difficult to trace down the offending lines of code in a large application. a quick and effective fix is to add the attached bit of javascript at the beginning of your application and open your debugger (chrome dev tools, firebug, node debugger, etc.).
you'll get a break point at the error and it's easy to fix from there.