I used to work with Java and from what I see unit testing Java is easier than unit testing JavaScript because Java is more rigid.
I'm sold on that test-driven development is the best thing so I'm also exploring how to unit test JavaScript. In Java I've mocked out the code that made connection to the database, the Data Access Objects, and I compare that to the code in JavaScript that changes the DOM and the code that makes AJAX calls to the server.
What I'm getting at is that it seems to me that what should be tested is the logic explicitly. For example, you don't want to make an AJAX call when you run unit tests because (a) you need the server to be running and (b) it is slow and one of the guidelines of unit testing is that it needs to be super fast so that the developers don't avoid running them like every minute.
Another guideline is for the continuous integration process to send an e-mail saying that it found a unit test that failed.
So my big question is: is there a unit testing tool that can be run by maven, for example, that has some JavaScript engine so that it doesn't rely on a browser because it will be in a Unix-like environment?