Skip to content

Commit

Permalink
chore: don't install bats twice (#1574)
Browse files Browse the repository at this point in the history
`bats` is already installed via npm (this was introduced in [#1252][1]),
so we don't need to install it in the CircleCI build file. The CircleCI
build file was also installing the original bats, while the [`local`][2] and
[`run`][3] packages install a [fork from npm][4].

In addition, I switched the command inside the bats runners from `npx
bats` (which will download/install the latest binary if `yarn install`
was not already run), to `yarn bats`, which will always use the version
specified in the lockfile. This is more consistent with how we run other
commands anyway.

[1]: #1252
[2]: https://github.com/heroku/cli/blob/62085d32f8fa3574bbe03bba707f1f576a9858bf/packages/local/bin/bats-test-runner.js
[3]: https://github.com/heroku/cli/blob/62085d32f8fa3574bbe03bba707f1f576a9858bf/packages/run/bin/bats-test-runner.js
[4]: https://www.npmjs.com/package/bats
  • Loading branch information
fivetanley authored Jul 30, 2020
1 parent 62085d3 commit 2715f9c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
10 changes: 2 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,6 @@ jobs:
- v4-yarn-{{ checksum ".circleci/config.yml" }}-{{ checksum "yarn.lock" }}
- v4-yarn-{{ checksum ".circleci/config.yml" }}
- v4-yarn
- run:
name: Installing bats
command: |
git clone https://github.com/sstephenson/bats.git
cd bats
./install.sh /usr/local
- run:
name: Installing dependencies
command: yarn
Expand Down Expand Up @@ -290,7 +284,7 @@ workflows:
- node12-test
- node10-test
filters: &master_dev_and_version_tags
tags:
tags:
<<: *version_tags
branches:
only:
Expand All @@ -317,7 +311,7 @@ workflows:
- node12-test
- node10-test
filters:
<<: *only_version_tags
<<: *only_version_tags
- invalidate_cdn_cache:
requires:
- install_scripts
Expand Down
2 changes: 1 addition & 1 deletion packages/local/bin/bats-test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ const os = require('os')
const {spawn} = require('child_process')

if (os.platform() === 'win32' || os.platform() === 'windows') console.log('skipping on windows')
else spawn('npx bats test/integration/*.bats', {stdio: 'inherit', shell: true})
else spawn('yarn bats test/integration/*.bats', {stdio: 'inherit', shell: true})
2 changes: 1 addition & 1 deletion packages/run/bin/bats-test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ const os = require('os')
const {spawn} = require('child_process')

if (os.platform() === 'win32' || os.platform() === 'windows') console.log('skipping on windows')
else spawn('npx bats test/integration/*.bats', {stdio: 'inherit', shell: true})
else spawn('yarn bats test/integration/*.bats', {stdio: 'inherit', shell: true})

0 comments on commit 2715f9c

Please sign in to comment.