From 2f4a293c462d19bfa22814b6ed64310badfc99ab Mon Sep 17 00:00:00 2001 From: Paulo Ragonha Date: Sat, 15 Apr 2017 11:32:08 +0200 Subject: [PATCH] =?UTF-8?q?Use=20headless=20Chrome=20instead=20of=20Phanto?= =?UTF-8?q?mJS=20to=20run=20tests=20=F0=9F=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have a couple of options going forward: - Always ship with the default PhantomJS support but use Chrome if it is available; - Completely ditch PhantomJS, and make Chrome another global dependency of Sagui. However, it is currently only available in the Canary release. More info https://www.chromestatus.com/features/5678767817097216 --- src/configure-karma/index.js | 10 +++++++++- src/configure-karma/index.spec.js | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/configure-karma/index.js b/src/configure-karma/index.js index 175f954..bdfe6d4 100644 --- a/src/configure-karma/index.js +++ b/src/configure-karma/index.js @@ -19,7 +19,15 @@ const buildStandardKarmaConfig = (saguiConfig, webpackConfig) => { basePath: projectPath, - browsers: ['PhantomJS'], + browsers: ['Chrome_headless'], + + // you can define custom flags + customLaunchers: { + Chrome_headless: { + base: 'ChromeCanary', + flags: ['--headless', '--remote-debugging-port=9222', 'http://0.0.0.0:9876/'] + } + }, reporters: [ 'mocha', diff --git a/src/configure-karma/index.spec.js b/src/configure-karma/index.spec.js index b23feef..846dbd4 100644 --- a/src/configure-karma/index.spec.js +++ b/src/configure-karma/index.spec.js @@ -20,7 +20,7 @@ describe('karma', function () { describe('extension', function () { it('should allow overwriting the default configuration', function () { - expect(karma(baseSaguiConfig, webpackConfig).browsers).eql(['PhantomJS']) + expect(karma(baseSaguiConfig, webpackConfig).browsers).eql(['Chrome_headless']) expect(karma({ ...baseSaguiConfig, additionalKarmaConfig: { browsers: ['Chrome'] } }, webpackConfig).browsers).eql(['Chrome']) }) })