Skip to content

Commit

Permalink
feat: Add ability to skip codecov (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbomb authored and Kent C. Dodds committed Nov 20, 2017
1 parent 8ad2df6 commit ae9ad82
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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`] = `
Expand Down
5 changes: 5 additions & 0 deletions src/scripts/__tests__/travis-after-success.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cases(
({
version = '0.0.0-semantically-released',
hasCoverageDir = true,
isOptedOutOfCoverage = false,
env = {
TRAVIS: 'true',
TRAVIS_BRANCH: 'master',
Expand Down Expand Up @@ -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()
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/travis-after-success.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ae9ad82

Please sign in to comment.