From b8be72a010c47e3e21f040903d3c804419b0d678 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 9 Mar 2017 22:55:37 +0100 Subject: [PATCH] fix: coverage issue with saucelabs * Saucelabs seems to have issues with Edge and the `karma-coverage` plugin. * Running on Browserstack seems to be work without any flakiness and also makes the build faster (runs less browsers than on saucelabs) --- scripts/ci/build-and-test.sh | 4 ++-- test/karma.conf.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/ci/build-and-test.sh b/scripts/ci/build-and-test.sh index 820bb1fe560f..53eca7120f6e 100755 --- a/scripts/ci/build-and-test.sh +++ b/scripts/ci/build-and-test.sh @@ -25,8 +25,8 @@ else $(npm bin)/gulp ci:test fi -# Don't upload coverage for both test modes (browserstack and saucelabs) and inside of PRs. -if [[ "$MODE" == "saucelabs_required" ]] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then +# Upload coverage results if those are present. +if [ -f dist/coverage/coverage-summary.json ]; then $(npm bin)/gulp ci:coverage fi diff --git a/test/karma.conf.js b/test/karma.conf.js index 49c1f7038ac0..c6ccd5ccf91c 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -100,7 +100,9 @@ module.exports = (config) => { if (process.env['TRAVIS']) { let buildId = `TRAVIS #${process.env.TRAVIS_BUILD_NUMBER} (${process.env.TRAVIS_BUILD_ID})`; - if (process.env['TRAVIS_PULL_REQUEST'] === 'false') { + if (process.env['TRAVIS_PULL_REQUEST'] === 'false' && + process.env['MODE'] === "browserstack_required") { + config.preprocessors['dist/@angular/material/**/!(*+(.|-)spec).js'] = ['coverage']; config.reporters.push('coverage'); }