I have been investigating the best way to do JS unit testing in our maven CI environment. What I currently have cobbled together is the following in my maven project:
The phantomjs-maven-plugin provides an install
goal for installing phantomjs so you don't need it pre-installed. After it installs phantomjs it sets a property with the path to the executable that other plugins can then use. It also has an exec
goal for executing phantomjs scripts. Full disclosure: I wrote the plugin.