diff --git a/src/scripts/__tests__/__snapshots__/travis-after-success.js.snap b/src/scripts/__tests__/__snapshots__/travis-after-success.js.snap index 74f78b77..a9500d01 100644 --- a/src/scripts/__tests__/__snapshots__/travis-after-success.js.snap +++ b/src/scripts/__tests__/__snapshots__/travis-after-success.js.snap @@ -6,6 +6,8 @@ exports[`travis-after-success does not do autorelease script when running on tra exports[`travis-after-success does not do the autorelease script when the version is different 1`] = `concurrently --prefix [{name}] --names codecov --prefix-colors bgBlue.bold.reset "echo installing codecov && npx -p codecov -c 'echo running codecov && codecov'"`; +exports[`travis-after-success does not do the codecov script when opted out 1`] = `concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@8 -c 'echo running semantic-release && semantic-release pre && npm publish && semantic-release post'"`; + exports[`travis-after-success does not do the codecov script when there is no coverage directory 1`] = `concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@8 -c 'echo running semantic-release && semantic-release pre && npm publish && semantic-release post'"`; exports[`travis-after-success does not run either script when no coverage dir and not the right version 1`] = ` diff --git a/src/scripts/__tests__/travis-after-success.js b/src/scripts/__tests__/travis-after-success.js index 67cfcd57..62176f34 100644 --- a/src/scripts/__tests__/travis-after-success.js +++ b/src/scripts/__tests__/travis-after-success.js @@ -8,6 +8,7 @@ cases( ({ version = '0.0.0-semantically-released', hasCoverageDir = true, + isOptedOutOfCoverage = false, env = { TRAVIS: 'true', TRAVIS_BRANCH: 'master', @@ -35,6 +36,7 @@ cases( utils.pkg.version = version } utils.hasFile = () => hasCoverageDir + process.env.SKIP_CODECOV = isOptedOutOfCoverage require('../travis-after-success') if (runsNothing) { expect(console.log.mock.calls).toMatchSnapshot() @@ -61,6 +63,9 @@ cases( 'does not do the codecov script when there is no coverage directory': { hasCoverageDir: false, }, + 'does not do the codecov script when opted out': { + isOptedOutOfCoverage: true, + }, 'does not do autorelease script when running on travis but in a pull request': { env: { TRAVIS: 'true', diff --git a/src/scripts/travis-after-success.js b/src/scripts/travis-after-success.js index 542ad95b..e692a35d 100644 --- a/src/scripts/travis-after-success.js +++ b/src/scripts/travis-after-success.js @@ -13,7 +13,7 @@ const autorelease = process.env.TRAVIS_BRANCH === 'master' && !parseEnv('TRAVIS_PULL_REQUEST', false) -const reportCoverage = hasFile('coverage') +const reportCoverage = hasFile('coverage') && !parseEnv('SKIP_CODECOV', false) if (!autorelease && !reportCoverage) { console.log(