Webpack: Headless Chrome for unit tests

Created on 25 May 2017  路  10Comments  路  Source: vuejs-templates/webpack

Headless Chrome (v59): https://developers.google.com/web/updates/2017/04/headless-chrome
Support in karma-chrome-launcher: https://github.com/karma-runner/karma-chrome-launcher/pull/111
Chrome release calendar: https://www.chromium.org/developers/calendar
Windows progress (maybe v60?): https://bugs.chromium.org/p/chromium/issues/detail?id=686608

Hi! Looks like finally, we will be able to use a headless version of Chrome for unit testing. What do you think about using Chrome instead of PhantomJS (or as an extra option)?

I've replaced PhantomJS with this headless Chrome in my local environment (like this) and it works well for now. Web Components and other new APIs can be used in tests :)

enhancement

Most helpful comment

I checked at my boilerplate too.

It's works! 馃殌

unit test:
screen shot 2017-07-02 at 12 30 37 am

e2e with ngihtwatch:
screen shot 2017-07-02 at 12 37 49 am

We should be used Chrome headless instead of PhantomJS. 馃槈

All 10 comments

Agreed PhantomJS is no longer being developed

We will definitely consider this. The question not if, just when.

I checked at my boilerplate too.

It's works! 馃殌

unit test:
screen shot 2017-07-02 at 12 30 37 am

e2e with ngihtwatch:
screen shot 2017-07-02 at 12 37 49 am

We should be used Chrome headless instead of PhantomJS. 馃槈

@kazupon The CI server doesn't even have a GUI, is Chrome headless available there?

@myst729, headless means "without GUI"

@myst729 Just install Google Chrome from your CI recipe. CircleCI example here -- latest google-chrome-stable for Linux includes "headless" feature, not sure about other OS.

Great! Will definitely give it a try.

@frandiox, same for Mac OS, not for windows yet

When Chrome headless will be part of vuejs webpack template by default?

We'll shortly be switching to Jest (#817) so Karma will only coexist as a "deprecated" alternative for a while.

Was this page helpful?
0 / 5 - 0 ratings