Skip to content

Commit

Permalink
Use Chrome Headless instead of Electron
Browse files Browse the repository at this point in the history
Since Chrome added an officially supported headless mode, there's no
reason to use Electron for our unit tests.  This will be both more accurate
(uses actual Chrome) and also gets rid of the rather large Electron
dependency.

WebGL is disabled in headless, so we only use headless on CI (because we
also disable webGL tests there).  When running locally, it just shows an
actual Chrome window. Chrome has an issue and plans to address this:
https://bugs.chromium.org/p/chromium/issues/detail?id=765284
  • Loading branch information
mramato committed Jul 24, 2018
1 parent 1f62bd9 commit abc3226
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ language: node_js
node_js:
- "8"
sudo: false
addons:
chrome: stable
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
Expand All @@ -17,7 +19,7 @@ script:

- echo 'test webgl-stub' && echo -en 'travis_fold:start:script.test\\r'
- npm run build
- npm run test -- --browsers Electron --webgl-stub --failTaskOnError --suppressPassed
- npm run test -- --browsers ChromeCI --webgl-stub --failTaskOnError --suppressPassed
- echo -en 'travis_fold:end:script.test\\r'

- echo 'makeZipFile' && echo -en 'travis_fold:start:script.makeZipFile\\r'
Expand All @@ -36,7 +38,7 @@ script:
- echo -en 'travis_fold:end:script.deploy\\r'

- echo 'test webgl-stub release' && echo -en 'travis_fold:start:script test.release\\r'
- npm run test -- --browsers Electron --failTaskOnError --webgl-stub --release --suppressPassed
- npm run test -- --browsers ChromeCI --failTaskOnError --webgl-stub --release --suppressPassed
- echo -en 'travis_fold:end:script test.release\\r'

- echo 'test node' && echo -en 'travis_fold:start:script test.node\\r'
Expand Down
10 changes: 8 additions & 2 deletions Specs/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ module.exports = function(config) {
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers : ['Chrome'],

electronOpts : {
show : false
//In Travis, we need to run with the no-sandbox flag
customLaunchers: {
ChromeCI: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox'
]
}
},

browserNoActivityTimeout : 30000,
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"cloc": "^2.3.3",
"compressible": "^2.0.9",
"compression": "^1.6.2",
"electron": "^1.6.1",
"eslint": "^4.0.0",
"eslint-plugin-html": "^4.0.2",
"event-stream": "^3.3.4",
Expand All @@ -58,7 +57,6 @@
"karma-chrome-launcher": "^2.0.0",
"karma-detect-browsers": "^2.2.3",
"karma-edge-launcher": "^0.4.2",
"karma-electron": "^5.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-ie-launcher": "^1.0.0",
"karma-jasmine": "^1.1.0",
Expand Down

0 comments on commit abc3226

Please sign in to comment.