PhantomJS vs jsdom: What are the differences?
PhantomJS and jsdom can be primarily classified as "Headless Browsers" tools.
Some of the features offered by PhantomJS are:
- Multiplatform, available on major operating systems: Windows, Mac OS X, Linux, and other Unices.
- Pure headless (no X11) on Linux, ideal for continuous integration systems. Also runs on Amazon EC2, Heroku, and Iron.io.
On the other hand, jsdom provides the following key features:
- Canvas support
- Encoding sniffing
- Closing down a jsdom
PhantomJS and jsdom are both open source tools. PhantomJS with 27K GitHub stars and 5.73K forks on GitHub appears to be more popular than jsdom with 12.9K GitHub stars and 1.16K GitHub forks.
What is jsdom?
What is PhantomJS?
Need advice about which tool to choose?Ask the StackShare community!
Why do developers choose jsdom?
What are the cons of using jsdom?
What are the cons of using PhantomJS?
Sign up to get full access to all the companiesMake informed product decisions
Sign up to get full access to all the tool integrationsMake informed product decisions
I wouldn't recommend it today, because PhantomJS is a basically dead project, and as a result, so is CasperJS. I expect we'll migrate to something else. We haven't in large part because 95% of our new tests are written with a simple Node.js-based unit testing framework we use that run 35K lines of unit tests covering most of our JS codebase in 3.6 seconds. And for the things where we want an integration test, CasperJS does work, and I think there's a good chance that waiting another year or two will result in our being able to switch to a much better option than what we'd get if we migrated now.
We run PhantomJS as part of the CircleCI testing, comparing against other branches to ensure changes are limited to their intended scope.
Headless browsing, headless chrome is good too, this is not supported anymore.