From 4d4a63e641604a553ad68b251a8b1406207ae9a8 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Fri, 10 Mar 2017 19:41:49 +0100 Subject: [PATCH] fix: coverage issue with saucelabs (#3540) * 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 c27eafe24f22..3dd0bc2cf4a8 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -106,7 +106,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'); }