Skip to content

Commit

Permalink
Use headless Chrome in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
xg-wang committed Feb 21, 2020
1 parent 7b12aea commit 4af5a86
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
18 changes: 4 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
sudo: false
language: node_js
node_js:
- "12"

before_install:
- "npm config set spin false"
# if npm version is less than 3.0.0, upgrade to 3
- if [[ $(npm -v | cut -d '.' -f 1) -lt 3 ]]; then npm i -g npm@^3; fi
- "npm config set spin false"

script: npm run test-ci
install:
- node --version
- npm --version
- git --version
- npm install
addons:
chrome: stable

script: yarn run test-ci

after_script:
- find ./coverage/Phantom* -name "lcov.info" -exec cat {} \; | coveralls
- find ./coverage/HeadlessChrome* -name "lcov.info" -exec cat {} \; | coveralls
11 changes: 9 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,15 @@ module.exports = function(config) {

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],

browsers: ['Chrome', 'ChromeHeadless', 'ChromeHeadlessNoSandbox'],

// you can define custom flags
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "npm run lint && npm run eslint && npm run tests-only",
"test-ci": "npm run build && npm run lint && npm run eslint && npm run tests-only-ci",
"tests-only": "karma start --single-run",
"tests-only-ci": "karma start --single-run --browsers PhantomJS",
"tests-only-ci": "karma start --single-run --browsers ChromeHeadlessNoSandbox",
"lint": "jshint test",
"eslint": "eslint src/**/*.ts test",
"test:server": "karma start --no-single-run"
Expand Down

0 comments on commit 4af5a86

Please sign in to comment.