Skip to content

Commit 7cbc9d1

Browse files
committed
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)
1 parent ce0e933 commit 7cbc9d1

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

scripts/ci/build-and-test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ else
2525
$(npm bin)/gulp ci:test
2626
fi
2727

28-
# Don't upload coverage for both test modes (browserstack and saucelabs) and inside of PRs.
29-
if [[ "$MODE" == "saucelabs_required" ]] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
28+
# Upload coverage results if those are present.
29+
if [ -f dist/coverage/coverage-summary.json ]; then
3030
$(npm bin)/gulp ci:coverage
3131
fi
3232

test/karma.conf.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ module.exports = (config) => {
100100
if (process.env['TRAVIS']) {
101101
let buildId = `TRAVIS #${process.env.TRAVIS_BUILD_NUMBER} (${process.env.TRAVIS_BUILD_ID})`;
102102

103-
if (process.env['TRAVIS_PULL_REQUEST'] === 'false') {
103+
if (process.env['TRAVIS_PULL_REQUEST'] === 'false' &&
104+
process.env['MODE'] === "browserstack_required") {
105+
104106
config.preprocessors['dist/@angular/material/**/!(*+(.|-)spec).js'] = ['coverage'];
105107
config.reporters.push('coverage');
106108
}

tools/gulp/tasks/coverage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ task('coverage:upload', () => {
99
throw new Error('No coverage file has been found!');
1010
}
1111

12-
if (!isTravisPushBuild()) {
12+
if (isTravisPushBuild()) {
1313
throw new Error('Coverage results will be only uploaded inside of Travis Push builds.');
1414
}
1515

0 commit comments

Comments
 (0)