-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#3128 replace phantomjs with chrome for browser tests #3152
Conversation
The Node v4 Travis tests failed: https://travis-ci.org/mochajs/mocha/jobs/316017544 Looks like puppeteer requires Node >= v6.4.0. If this is the desired path, it would have to wait on #3149. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puppeteer v0.13.0 won't run in Node.js v4.x.
Unfortunately, there's no such thing as an "optional dev dependency". This would be nice, since we don't actually need it, since we only run the browser tests from Node.js v8.x.
Would downgrading to a version that supports Node.js v4.x work? Happy to hear other suggestions as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the commit message seems to have a typo
c5a128b
to
316e258
Compare
@boneskull thanks for the feedback, I fixed the commit message.
Agreed, but it is nice to be able to depend on puppeteer's binary instead of adding dependencies to resolve the paths to Chrome.
I looked through the commit history for the project and I don't think this is viable since the project makes heavy use of ES6 features (like destructuring and default function params) that are not supported on older versions of Node, unfortunately. I'm going to follow this guide and tinker some more with the Karma config to try and get this working without puppeteer as a dependency. |
fcce7b2
to
e623926
Compare
@boneskull I removed puppeteer since I updated the Travis config based on https://docs.travis-ci.com/user/chrome but I don't think we need to do the additional setup for Chrome headless here since Karma takes care of launching Chrome. The Appveyor config doesn't need to be updated since Chrome is included in the build worker images (see https://www.appveyor.com/docs/build-environment/#test-runners). |
e623926
to
aa02506
Compare
@boneskull let me know your feedback once you get a chance to review the changes I pushed, thanks! |
thanks |
I'm going to pull this down and try it out; I'll address the conflict in |
awesome. merged via e54370e thanks @akrawchyk |
Description of the Change
Replaces PhantomJS with Puppeteer and updates Karma to use
ChromeHeadless
browser.Alternate Designs
The issue #3128 describes using
karma-headless-chrome-launcher
for this.However, the project already has
karma-chrome-launcher
as a dependency, see #3152 (comment).which has documentation for setting upChromeHeadless
, see https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer. I thought this would be preferred, so I configured Karma to use Puppeteer.Also, during my testing thekarma-headless-chrome-launcher
was unable to locate Chromium. I'm not sure it's supported by the library used to locate Chrome for that plugin, see hughsk/chrome-location#7.karma-chrome-launcher
does not locate Chromium by default either. Both Travis and Appveyor use Google Chrome, but you can use Chromium to run tests locally by setting theCHROME_BIN
env var:Why should this be in core?
#3128 (comment)
Benefits
#3128 (comment)
Possible Drawbacks
Puppeteer downloads a usable Chrome binary on install. This download is currently >95MB in size compared to PhantomJS <20MB, almost 5x bigger download. This is undesirable for obvious reasons.