From 56236998f9734d7990d208fcb844cf29d972be71 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Sat, 7 Apr 2018 07:18:07 -0600 Subject: [PATCH] fix(semantic-release): _actually_ update semantic-release --- .../__tests__/__snapshots__/precommit.js.snap | 12 ++++++++++++ .../__snapshots__/travis-after-success.js.snap | 6 +++--- src/scripts/__tests__/precommit.js | 10 ++++++---- src/scripts/travis-after-success.js | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/scripts/__tests__/__snapshots__/precommit.js.snap b/src/scripts/__tests__/__snapshots__/precommit.js.snap index f1d08a31..6f610691 100644 --- a/src/scripts/__tests__/__snapshots__/precommit.js.snap +++ b/src/scripts/__tests__/__snapshots__/precommit.js.snap @@ -2,12 +2,24 @@ exports[`precommit calls lint-staged CLI with default args 1`] = `lint-staged --config ./src/config/lintstagedrc.js`; +exports[`precommit calls lint-staged CLI with default args 2`] = `npm run validate`; + exports[`precommit does not use built-in config with .lintstagedrc file 1`] = `lint-staged`; +exports[`precommit does not use built-in config with .lintstagedrc file 2`] = `npm run validate`; + exports[`precommit does not use built-in config with --config 1`] = `lint-staged --config ./custom-config.js`; +exports[`precommit does not use built-in config with --config 2`] = `npm run validate`; + exports[`precommit does not use built-in config with lint-staged pkg prop 1`] = `lint-staged`; +exports[`precommit does not use built-in config with lint-staged pkg prop 2`] = `npm run validate`; + exports[`precommit does not use built-in config with lint-staged.config.js file 1`] = `lint-staged`; +exports[`precommit does not use built-in config with lint-staged.config.js file 2`] = `npm run validate`; + exports[`precommit forwards args 1`] = `lint-staged --config ./src/config/lintstagedrc.js --verbose`; + +exports[`precommit forwards args 2`] = `npm run validate`; diff --git a/src/scripts/__tests__/__snapshots__/travis-after-success.js.snap b/src/scripts/__tests__/__snapshots__/travis-after-success.js.snap index faaa5f9f..8fac3265 100644 --- a/src/scripts/__tests__/__snapshots__/travis-after-success.js.snap +++ b/src/scripts/__tests__/__snapshots__/travis-after-success.js.snap @@ -2,7 +2,7 @@ exports[`travis-after-success calls concurrently with both scripts when on travis 1`] = `npx travis-deploy-once`; -exports[`travis-after-success calls concurrently with both scripts when on travis 2`] = `concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@8 -c 'echo running semantic-release && semantic-release'"`; +exports[`travis-after-success calls concurrently with both scripts when on travis 2`] = `concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@15 -c 'echo running semantic-release && semantic-release'"`; exports[`travis-after-success does not do autorelease script when running on travis but in a pull request 1`] = `npx travis-deploy-once`; @@ -14,11 +14,11 @@ exports[`travis-after-success does not do the autorelease script when the versio exports[`travis-after-success does not do the codecov script when opted out 1`] = `npx travis-deploy-once`; -exports[`travis-after-success does not do the codecov script when opted out 2`] = `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'"`; +exports[`travis-after-success does not do the codecov script when opted out 2`] = `concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@15 -c 'echo running semantic-release && semantic-release'"`; exports[`travis-after-success does not do the codecov script when there is no coverage directory 1`] = `npx travis-deploy-once`; -exports[`travis-after-success does not do the codecov script when there is no coverage directory 2`] = `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'"`; +exports[`travis-after-success does not do the codecov script when there is no coverage directory 2`] = `concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@15 -c 'echo running semantic-release && semantic-release'"`; exports[`travis-after-success does not run either script when no coverage dir and not the right version 1`] = ` Array [ diff --git a/src/scripts/__tests__/precommit.js b/src/scripts/__tests__/precommit.js index d4ce4982..65f21d4b 100644 --- a/src/scripts/__tests__/precommit.js +++ b/src/scripts/__tests__/precommit.js @@ -29,10 +29,12 @@ cases( try { // tests require('../precommit') - expect(crossSpawnSyncMock).toHaveBeenCalledTimes(1) - const [firstCall] = crossSpawnSyncMock.mock.calls - const [script, calledArgs] = firstCall - expect([script, ...calledArgs].join(' ')).toMatchSnapshot() + expect(crossSpawnSyncMock).toHaveBeenCalledTimes(2) + const [firstCall, secondCall] = crossSpawnSyncMock.mock.calls + const [scriptOne, calledArgsOne] = firstCall + expect([scriptOne, ...calledArgsOne].join(' ')).toMatchSnapshot() + const [scriptTwo, calledArgsTwo] = secondCall + expect([scriptTwo, ...calledArgsTwo].join(' ')).toMatchSnapshot() } catch (error) { throw error } finally { diff --git a/src/scripts/travis-after-success.js b/src/scripts/travis-after-success.js index 460f97d7..4f50d1eb 100644 --- a/src/scripts/travis-after-success.js +++ b/src/scripts/travis-after-success.js @@ -38,7 +38,7 @@ function runAfterSuccessScripts() { ? `echo installing codecov && npx -p codecov -c 'echo running codecov && codecov'` : null, release: autorelease - ? `echo installing semantic-release && npx -p semantic-release@8 -c 'echo running semantic-release && semantic-release'` + ? `echo installing semantic-release && npx -p semantic-release@15 -c 'echo running semantic-release && semantic-release'` : null, }, {killOthers: false},