I made a patch which has a light-weight unit-testing framework for JS.
Currently it has no UI, but you can run Drupal.test() through firebug.
Also, the checkPlain tests don't pass, and this is for good reason, because checkPlain is broken (yay tests!).
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 237566-qunit-v7.patch.
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 237566-qunit_6.patch.
Passed: 12934 passes, 0 fails, 0 exceptions