refactor & support mocha and phantomjs options