js-test.el is an elisp package which sits on top of js2-mode and js-comint.el and parses your javascript to let you call a pure javascript unit-testing library, such as simpletest.js to automagically test your code as you write it.

For example, put js-comint.el in your load-path, and then add the following lines to your .emacs:

(require 'js-comint)
(setq inferior-js-program-command "/usr/bin/java org.mozilla.javascript.tools.shell.Main")
(add-hook 'js2-mode-hook '(lambda () 
			    (local-set-key "\C-x\C-e" 'js-send-last-sexp)
			    (local-set-key "\C-\M-x" 'js-send-last-sexp-and-go)
			    (local-set-key "\C-cb" 'js-send-buffer)
			    (local-set-key "\C-c\C-b" 'js-send-buffer-and-go)
			    (local-set-key "\C-cl" 'js-load-file-and-go)
You can then try out any piece of javascript code in a javascript interpreter by simply typing C-x C-e at the end of the sexp. js-comint will use js2-mode to find the last sexp, run Rhino, and load the sexp it just found into the interpreter. This, it turns out, is extremely useful, particularly when you're writing non-domish, algorithmic javascript.

The latest version of js-test.el can be downloaded here.
Related projects
If the js-test.el isn't enough to convince you to try it out by itself, consider checking out js-test.el which is a companion piece of elisp which sits above js-comint.el and, when used in conjunction with a pure javascript unit testing library, can run tests from your emacs javascript buffer.
Hosting generously provided by: SourceForge.net Logo