Skip to content

v4.0 - direct dependency on phantomjs, no more `mochaPhantomJS` global

Latest
Compare
Choose a tag to compare
@nathanboktae nathanboktae released this 21 Sep 07:29
· 18 commits to master since this release

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.

  1. mocha-phantomjs directly depends on phantomjs. You can remove phantomjs that you likely directly declared from #167 's need to cap phantomjs to 1.9.7-15, and it will install without errors or warning by avoiding the peerDependencies bag of hurt.
  2. mochaPhantomJS no longer exists. You can simply call mocha.run() as normal. If you were using this to detect phantomjs, please use 'callPhantom' in window instead.
  3. 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.
  4. 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.
  5. Errors are now logged to stderr #162.