HtmlUnit has a good support for JavaScript which gets continuously improved, and test cases for complex libraries (Dojo, jQuery, Prototype, Google Web Toolkit, Yahoo User Interface and Sarissa) are already included.
However, not all test cases succeed, and you would probably face an issue in real-life example.

Before reporting an issue with JavaScript, it is very preferred if you isolate the root cause, but just saying 'Dojo' is not working doesn't help much.
To find the offending line, you can put alert() at various places, compare the result of HtmlUnit to a real browser (Internet Explorer or Firefox), and you will mostly be able to provide a tiny failing test case which contains few lines of JavaScript with or without Html (independent of the whole JavaScript library), please have a look in these cases .
Once the cause is identified, it is very likely to be fixed in a timely manner.

If you need any help in tracing, please don't hesitate to ask the team.