v4.0 is here and was originally intended to be the release to switch over to PhantomJS 2, but not all official linux binaries are out after 9 months after the original release (see Medium/phantomjs#288, ariya/phantomjs#12948, #175). However the core phantomjs code has been moved out to mocha-phantomjs-core which does support phantomjs2, so you can use phantomjs 2 with your test if you bring your own binary:
mocha-phantomjs -p /path/to/phantomjs2 tests/mytests.html
Not So Breaking Changes
"Not so" much as 95% of you won't notice anything and it will just work, but the first two will be nice improvements to do.
mocha-phantomjs
directly depends onphantomjs
. You can removephantomjs
that you likely directly declared from #167 's need to cap phantomjs to1.9.7-15
, and it will install without errors or warning by avoiding thepeerDependencies
bag of hurt.mochaPhantomJS
no longer exists. You can simply callmocha.run()
as normal. If you were using this to detect phantomjs, please use'callPhantom' in window
instead.- Due to the above, using RequireJS or another script load mocha is not supported. mocha always exposes globals anyways, so there is no benefit to this, as well as loading your tests with an AMD loader is just more work than script tags. Also I highly recommend using server side templating of your test HTML with tests from your test directory so you don't forget to include a new set of tests in your test run. However you can load your product and test code asynchronously, just not mocha itself.
- All the phantomjs code no longer lives in this repository, but in mocha-phantomjs-core. It was rewritten in plain JavaScript since PhantomJS 2 removed CofffeScript support and to support plugin authors to have more control (#175). Please keep this in mind when filing issues - anything related to phantomjs interaction, browser side bugs, etc. should go there.
- Errors are now logged to stderr #162.