busser-bats 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +32 -0
  3. data/.github/workflows/pr-title.yml +28 -0
  4. data/.github/workflows/publish.yml +67 -0
  5. data/.gitignore +0 -1
  6. data/.release-please-manifest.json +3 -0
  7. data/.rubocop.yml +2 -7
  8. data/.yamllint +6 -0
  9. data/CHANGELOG.md +23 -1
  10. data/CONTRIBUTING.md +86 -0
  11. data/Gemfile +9 -13
  12. data/README.md +100 -30
  13. data/Rakefile +43 -24
  14. data/busser-bats.gemspec +23 -15
  15. data/config/features/support/env.rb +0 -5
  16. data/features/support/env.rb +5 -14
  17. data/features/test_command.feature +31 -31
  18. data/lib/busser/bats/version.rb +3 -1
  19. data/lib/busser/runner_plugin/bats.rb +27 -3
  20. data/release-please-config.json +15 -0
  21. data/renovate.json +2 -2
  22. data/spec/busser/runner_plugin/bats_spec.rb +41 -0
  23. data/spec/spec_helper.rb +2 -0
  24. data/vendor/bats/LICENSE.md +53 -0
  25. data/vendor/bats/README.md +84 -242
  26. data/vendor/bats/VERSION.txt +1 -1
  27. data/vendor/bats/bin/bats +75 -0
  28. data/vendor/bats/install.sh +20 -28
  29. data/vendor/bats/lib/bats-core/common.bash +278 -0
  30. data/vendor/bats/lib/bats-core/formatter.bash +151 -0
  31. data/vendor/bats/lib/bats-core/preprocessing.bash +19 -0
  32. data/vendor/bats/lib/bats-core/semaphore.bash +113 -0
  33. data/vendor/bats/lib/bats-core/test_functions.bash +539 -0
  34. data/vendor/bats/lib/bats-core/tracing.bash +425 -0
  35. data/vendor/bats/lib/bats-core/validator.bash +37 -0
  36. data/vendor/bats/lib/bats-core/warnings.bash +44 -0
  37. data/vendor/bats/libexec/bats-core/bats +549 -0
  38. data/vendor/bats/libexec/bats-core/bats-exec-file +402 -0
  39. data/vendor/bats/libexec/bats-core/bats-exec-suite +342 -0
  40. data/vendor/bats/libexec/bats-core/bats-exec-test +383 -0
  41. data/vendor/bats/libexec/bats-core/bats-format-cat +6 -0
  42. data/vendor/bats/libexec/bats-core/bats-format-junit +293 -0
  43. data/vendor/bats/libexec/bats-core/bats-format-pretty +360 -0
  44. data/vendor/bats/libexec/bats-core/bats-format-tap +55 -0
  45. data/vendor/bats/libexec/bats-core/bats-format-tap13 +89 -0
  46. data/vendor/bats/libexec/bats-core/bats-gather-tests +402 -0
  47. data/vendor/bats/libexec/bats-core/bats-preprocess +118 -0
  48. data/vendor/bats/man/Makefile +16 -3
  49. data/vendor/bats/man/bats.1 +100 -58
  50. data/vendor/bats/man/bats.1.ronn +102 -12
  51. data/vendor/bats/man/bats.7 +205 -83
  52. data/vendor/bats/man/bats.7.ronn +262 -14
  53. data/vendor/bats/uninstall.sh +63 -0
  54. metadata +44 -22
  55. data/.github/dependabot.yml +0 -8
  56. data/.github/workflows/lint.yaml +0 -9
  57. data/.github/workflows/publish.yaml +0 -35
  58. data/.tool-versions +0 -1
  59. data/Guardfile +0 -26
  60. data/vendor/bats/.gitattributes +0 -3
  61. data/vendor/bats/.travis.yml +0 -5
  62. data/vendor/bats/LICENSE +0 -20
  63. data/vendor/bats/bin/bats +0 -1
  64. data/vendor/bats/package.json +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80dd7f4f2a1bdbedde3ed56dd1d06006cf12500493e324aff04f3cc97d6fc847
4
- data.tar.gz: 624cb79b0320e718ab509df144b17abd454f0d7f98394398f73269577177c64a
3
+ metadata.gz: 50827f7c53a1bce1a7ddc9bda08aacd3d7a2388fefc183b7bdc3cbdd23bac07f
4
+ data.tar.gz: 3a22e249cc415c99bdfd3f922b0a4d13665f267eb14216f2c1d226f76354ade3
5
5
  SHA512:
6
- metadata.gz: 04744f07800df27d669bad4cec84c8c5ff2988ae47dcf1a277bf3d57fc1652116c02503311e9c081a9f754456967576c45adc452a7e78ea7c8dc971b73a52164
7
- data.tar.gz: 65fc095f1ad7197228ae0ea880f5cb03b3963d8ab1a3e1fa10b19adfd5c6596fa0779397ba30ad8594bbce5f7c92c6fa5c0dfbab6b0b85de6fb56aadc971c44c
6
+ metadata.gz: c00aef02c07f8518d484107f04165d2e320cc0a822c36b7e74350795c84ce5e3b7d7a221cf75e0e679a9623995db2f2ee44a058b729a73a73442b8a56c38855f
7
+ data.tar.gz: 65749c81f7d399d2a2ce2c64eda0bc3235c815e7e1a7c6a2b0beef4756d8db414589140cdfc8df02d00da757d426eaf2f61bbcf3ab0c2cdb0f122401d96593fd
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: "Test"
3
+
4
+ "on":
5
+ push:
6
+ branches: [main]
7
+ pull_request:
8
+ workflow_dispatch:
9
+
10
+ # The default token is granted write access to most of the repository.
11
+ # Nothing here needs more than the checkout.
12
+ permissions:
13
+ contents: read
14
+
15
+ # Supersede in-flight runs for a branch. Pull requests cancel freely, but
16
+ # pushes to main do not: every commit on main should keep a build of its own.
17
+ concurrency:
18
+ group: ${{ github.workflow }}-${{ github.ref }}
19
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
20
+
21
+ jobs:
22
+ lint-unit:
23
+ # Pinned to a commit rather than @main so an upstream edit cannot reach
24
+ # this repository's CI without a reviewed pull request. The trailing
25
+ # comment names the release the commit belongs to, which is what lets
26
+ # Renovate track the pin by version and keep both in step.
27
+ uses: test-kitchen/.github/.github/workflows/lint-unit.yml@95ef7803cf23aae5ee68593de5b7e0a731c1a929 # v0.4.0
28
+ with:
29
+ # This gem requires Ruby 3.2, and so do busser 0.9 and cucumber 11.
30
+ # Without this the shared workflow would still start a Ruby 3.1 job and
31
+ # bundler would refuse to resolve there.
32
+ ruby_versions: '["3.2", "3.3", "3.4", "4.0"]'
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: "PR Title"
3
+
4
+ "on":
5
+ pull_request_target:
6
+ types: [opened, edited, reopened, synchronize]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ conventional-title:
13
+ name: "Conventional commit title"
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ pull-requests: read
17
+ steps:
18
+ # Pull requests here are squash merged, so the pull request title becomes
19
+ # the commit subject on main. That makes the title the one place worth
20
+ # checking: release-please reads those subjects to decide the next
21
+ # version and to build the changelog.
22
+ #
23
+ # pull_request_target is used so the check also runs for pull requests
24
+ # from forks. No repository code is checked out in this job, so none of
25
+ # the usual pull_request_target risk applies.
26
+ - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
27
+ env:
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: "Release"
3
+
4
+ "on":
5
+ push:
6
+ branches: [main]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ release-please:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: write # tag the release and commit the version bump
16
+ pull-requests: write # open and update the release pull request
17
+ packages: write # push the gem to GitHub Packages
18
+ steps:
19
+ # Opens and maintains a release pull request. Merging that pull request
20
+ # is what actually cuts a release, so every step below is skipped until
21
+ # release_created is set.
22
+ - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
23
+ id: release
24
+ with:
25
+ token: ${{ secrets.PORTER_GITHUB_TOKEN }}
26
+
27
+ - name: Checkout code
28
+ if: ${{ steps.release.outputs.release_created }}
29
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30
+
31
+ # These two steps are handed publishing credentials, so they are pinned
32
+ # to a commit rather than a branch. A floating ref would let whoever
33
+ # controls that branch run code with a token that can push this gem.
34
+ - name: Publish to GitHub Packages
35
+ if: ${{ steps.release.outputs.release_created }}
36
+ uses: actionshub/publish-gem-to-github@86eb0ce1ced1072298bf68776a32a5c9703ad9aa # v1.0.13
37
+ with:
38
+ token: ${{ secrets.GITHUB_TOKEN }}
39
+ owner: ${{ github.repository_owner }}
40
+
41
+ - name: Publish to RubyGems
42
+ if: ${{ steps.release.outputs.release_created }}
43
+ uses: actionshub/publish-gem-to-rubygems@f9126f7a2d36a4fd31a13e78fde5fbdcc4b7b251 # v2.0.6
44
+ with:
45
+ token: ${{ secrets.RUBYGEMS_API_KEY }}
46
+
47
+ # actionshub/publish-gem-to-rubygems logs a rejected push and still exits
48
+ # 0, so a release that never reached RubyGems shows up as a green job.
49
+ # Ask RubyGems directly instead of trusting the step. The v2 endpoint is
50
+ # 404 until the exact version is indexed, so -f turns "not there" into a
51
+ # non-zero exit rather than a substring match on `gem list` output.
52
+ - name: Verify the release reached RubyGems
53
+ if: ${{ steps.release.outputs.release_created }}
54
+ env:
55
+ VERSION: ${{ steps.release.outputs.version }}
56
+ run: |
57
+ set -euo pipefail
58
+ name="$(basename "$(ls ./*.gemspec)" .gemspec)"
59
+ for _ in $(seq 1 12); do
60
+ if curl -fsS -o /dev/null "https://rubygems.org/api/v2/rubygems/${name}/versions/${VERSION}.json"; then
61
+ echo "${name} ${VERSION} is on RubyGems"
62
+ exit 0
63
+ fi
64
+ sleep 15
65
+ done
66
+ echo "::error::${name} ${VERSION} never reached RubyGems. A permissions failure in the push step above does not fail that step -- read its log."
67
+ exit 1
data/.gitignore CHANGED
@@ -6,7 +6,6 @@
6
6
  Gemfile.lock
7
7
  InstalledFiles
8
8
  _yardoc
9
- coverage
10
9
  doc/
11
10
  lib/bundler/man
12
11
  pkg
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.7.0"
3
+ }
data/.rubocop.yml CHANGED
@@ -1,11 +1,6 @@
1
1
  ---
2
2
  require:
3
- - chefstyle
3
+ - cookstyle/chefstyle
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 2.7
7
- Include:
8
- - "**/*.rb"
9
- Exclude:
10
- - "vendor/**/*"
11
- - "spec/**/*"
6
+ TargetRubyVersion: 3.2
data/.yamllint ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ extends: default
3
+ rules:
4
+ line-length:
5
+ max: 256
6
+ level: warning
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # busser-bats Changelog
2
2
 
3
+ ## [0.7.0](https://github.com/test-kitchen/busser-bats/compare/v0.6.0...v0.7.0) (2026-08-28)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * the vendored bats goes from 0.4.0 to 1.14.0. Suites relying on bats 0.4 behaviour may need updating; see the bats-core changelog.
9
+
10
+ ### Features
11
+
12
+ * vendor bats-core instead of the archived sstephenson/bats ([#59](https://github.com/test-kitchen/busser-bats/issues/59)) ([377240c](https://github.com/test-kitchen/busser-bats/commit/377240cbf04dee7bdec158fc306bbc5a7e7fe509))
13
+
14
+ ## [0.6.0](https://github.com/test-kitchen/busser-bats/compare/v0.5.0...v0.6.0) (2026-08-28)
15
+
16
+
17
+ ### ⚠ BREAKING CHANGES
18
+
19
+ * Ruby 3.1 and busser releases older than 0.9.0 are no longer supported.
20
+
21
+ ### Features
22
+
23
+ * require Ruby 3.2 and busser 0.9, adopt release-please ([#44](https://github.com/test-kitchen/busser-bats/issues/44)) ([3aa285e](https://github.com/test-kitchen/busser-bats/commit/3aa285e63f0b2f0b79666525022308eb14eee1c3))
24
+
3
25
  ## [0.5.0](https://github.com/test-kitchen/busser-bats/compare/v0.4.0...v0.5.0) (2023-11-30)
4
26
 
5
27
 
@@ -28,7 +50,7 @@
28
50
 
29
51
  * Upgrade vendored bats version to 0.4.0. ([@fnichol][])
30
52
 
31
- ### Improvments
53
+ ### Improvements
32
54
 
33
55
  * Update testing dependencies, upgrade to RSpec 3.x, freshen TravisCI build matrix, add style and complexity support. ([@fnichol][])
34
56
  * Allow Aruba tests to wait 20 seconds (vs. 10). ([@fnichol][])
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,86 @@
1
+ # Contributing to busser-bats
2
+
3
+ Thanks for taking the time to contribute. This document covers how to get the
4
+ project running locally, how to check your work before opening a pull request,
5
+ and the commit convention releases depend on.
6
+
7
+ ## Getting set up
8
+
9
+ This plugin requires **Ruby 3.2 or newer**. Clone the repository and install the
10
+ development dependencies:
11
+
12
+ ```bash
13
+ git clone https://github.com/test-kitchen/busser-bats.git
14
+ cd busser-bats
15
+ bundle install
16
+ ```
17
+
18
+ ## Running the tests
19
+
20
+ `rake` runs the whole suite:
21
+
22
+ ```bash
23
+ bundle exec rake test
24
+ ```
25
+
26
+ The tests are [cucumber](https://cucumber.io) features in `features/`. They
27
+ drive the real `busser` executable through
28
+ [aruba](https://github.com/cucumber/aruba) rather than calling the plugin's
29
+ classes, so they cover it end to end: install the plugin into a throwaway
30
+ Busser root, write a suite, run it, and check what came out. The step
31
+ definitions they use are published by busser itself, in `lib/busser/cucumber.rb`.
32
+
33
+ ## Linting
34
+
35
+ CI runs three linters, all of which you can run locally:
36
+
37
+ ```bash
38
+ bundle exec cookstyle --chefstyle # Ruby
39
+ yamllint --strict . # YAML
40
+ markdownlint-cli2 "**/*.md" "!**/CHANGELOG*.md"
41
+ ```
42
+
43
+ ## Commit messages
44
+
45
+ This project uses [Conventional Commits](https://www.conventionalcommits.org).
46
+ Releases are automated, and the commit subject on `main` is what decides the
47
+ next version number and what appears in the changelog.
48
+
49
+ Pull requests are **squash merged, so the pull request title becomes that
50
+ subject**. A CI check enforces the format on the title; the individual commits
51
+ on your branch are not checked.
52
+
53
+ | Prefix | Effect on the next release |
54
+ | --- | --- |
55
+ | `fix:` | Patch version bump |
56
+ | `feat:` | Minor version bump |
57
+ | `feat!:`, or a `BREAKING CHANGE:` footer | Minor bump, until this gem reaches 1.0 |
58
+ | `chore:`, `docs:`, `ci:`, `test:`, `refactor:` | No release |
59
+
60
+ For example:
61
+
62
+ ```text
63
+ fix: install the plugin into GEM_HOME rather than the bundle
64
+ feat: support a Gemfile alongside the suite
65
+ ci: pin the shared workflow to a release
66
+ ```
67
+
68
+ ## Opening a pull request
69
+
70
+ 1. Fork the repository and create a branch for your change.
71
+ 2. Add or update tests. A bug fix should come with a test that fails without it.
72
+ 3. Run `bundle exec rake test` and the linters above.
73
+ 4. Open a pull request with a Conventional Commits title.
74
+
75
+ ## Releases
76
+
77
+ Releases are handled by
78
+ [release-please](https://github.com/googleapis/release-please). It watches
79
+ commits landing on `main` and keeps a release pull request open with the next
80
+ version number and the accumulated changelog. Merging that pull request tags the
81
+ release and publishes the gem to RubyGems and GitHub Packages.
82
+
83
+ Maintainers do not bump `lib/busser/bats/version.rb` or edit
84
+ `CHANGELOG.md` by hand; release-please owns both files. This gem is still pre-1.0, so
85
+ `bump-minor-pre-major` is set and a breaking change takes the minor rather than
86
+ graduating it to 1.0.
data/Gemfile CHANGED
@@ -2,23 +2,19 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- group :guard do
6
- gem "guard-cucumber"
7
- gem "guard-cane"
8
- gem "guard-rubocop"
5
+ group :cookstyle do
6
+ gem "cookstyle", ">= 9.0"
9
7
  end
10
8
 
11
9
  group :test do
12
- gem "rake", ">= 11.0"
13
- gem "rspec", "~> 3.2"
14
- gem "aruba"
10
+ gem "aruba", ">= 2.4"
11
+ gem "base64", ">= 0.3" # cucumber needs it; not a default gem on Ruby 4.0
12
+ gem "cucumber", ">= 11.1"
13
+ gem "minitest", ">= 6.0"
14
+ gem "mocha", ">= 2.7"
15
+ gem "rake", ">= 13.4"
15
16
  end
16
17
 
17
18
  group :development do
18
- gem "countloc"
19
- gem "simplecov"
20
- end
21
-
22
- group :chefstyle do
23
- gem "chefstyle", "2.2.3"
19
+ gem "yard", ">= 0.9.37"
24
20
  end
data/README.md CHANGED
@@ -1,52 +1,122 @@
1
- # Busser::RunnerPlugin::Bats
1
+ # busser-bats
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/busser-bats.png)](http://badge.fury.io/rb/busser-bats)
4
- [![Build Status](https://travis-ci.org/test-kitchen/busser-bats.png?branch=master)](https://travis-ci.org/test-kitchen/busser-bats)
5
- [![Code Climate](https://codeclimate.com/github/test-kitchen/busser-bats.png)](https://codeclimate.com/github/test-kitchen/busser-bats)
3
+ [![Gem Version](https://badge.fury.io/rb/busser-bats.svg)](https://badge.fury.io/rb/busser-bats)
6
4
 
7
- A Busser runner plugin for [Bats][bats_site]
5
+ A [Busser](https://github.com/test-kitchen/busser) runner plugin that runs
6
+ [Bats](https://github.com/bats-core/bats-core) test files.
7
+
8
+ Bats is a TAP-producing test harness for bash. This plugin vendors a copy of it,
9
+ installs that copy onto the machine under test during postinstall, and then runs
10
+ it against the suite's `bats` directory — so the machine under test needs
11
+ nothing beyond bash.
12
+
13
+ The vendored copy is [bats-core](https://github.com/bats-core/bats-core), which
14
+ is the maintained fork; `vendor/bats/VERSION.txt` records the exact release.
15
+ `rake bats:vendor` refreshes it, and `BATS_VERSION` selects a different tag.
8
16
 
9
17
  ## Status
10
18
 
11
- This software project is no longer under active development as it has no active maintainers. The software may continue to work for some or all use cases, but issues filed in GitHub will most likely not be triaged. If a new maintainer is interested in working on this project please come chat with us in #test-kitchen on Chef Community Slack.
19
+ This software project is no longer under active development as it has no active
20
+ maintainers. The software may continue to work for some or all use cases, but
21
+ issues filed in GitHub will most likely not be triaged. If a new maintainer is
22
+ interested in working on this project please come chat with us in #test-kitchen
23
+ on Chef Community Slack.
24
+
25
+ ## Requirements
26
+
27
+ Ruby 3.2 or newer, and busser 0.9.0 or newer.
28
+
29
+ ## Installation
12
30
 
13
- ## Installation and Setup
31
+ Busser installs the plugin for you when Test Kitchen runs the suite, so there is
32
+ usually nothing to do. To install it by hand:
14
33
 
15
- Until proper reference documentation is complete, the [Writing a Test](http://kitchen.ci/docs/getting-started/writing-test) section of the Test Kitchen's [Getting Started Guide](http://kitchen.ci/docs/getting-started/) gives a working example of creating a bats test.
34
+ ```bash
35
+ busser plugin install busser-bats
36
+ ```
16
37
 
17
38
  ## Usage
18
39
 
19
- **TODO:** Write documentation explaining the structure/format of testing files.
40
+ Put your `.bats` files in the `bats` directory of a suite:
20
41
 
21
- ## Development
42
+ ```text
43
+ test
44
+ `-- integration
45
+ `-- default # suite name
46
+ `-- bats
47
+ `-- default.bats
48
+ ```
22
49
 
23
- * Source hosted at [GitHub][repo]
24
- * Report issues/questions/feature requests on [GitHub Issues][issues]
50
+ The whole directory is handed to `bats`, which picks up every `*.bats` file in
51
+ it. A test is a `@test` block, and it passes when every command in it succeeds:
25
52
 
26
- Pull requests are very welcome! Make sure your patches are well tested.
27
- Ideally create a topic branch for every separate change you make. For
28
- example:
53
+ ```bash
54
+ @test "foobar.txt was created" {
55
+ run cat /usr/local/foobar.txt
56
+ [ "$status" -eq 0 ]
57
+ [ "$output" = "hello" ]
58
+ }
59
+ ```
29
60
 
30
- 1. Fork the repo
31
- 2. Create your feature branch (`git checkout -b my-new-feature`)
32
- 3. Commit your changes (`git commit -am 'Added some feature'`)
33
- 4. Push to the branch (`git push origin my-new-feature`)
34
- 5. Create new Pull Request
61
+ See the [Bats documentation](https://bats-core.readthedocs.io) for the full
62
+ assertion and helper vocabulary.
35
63
 
36
- ## Authors
64
+ Test Kitchen picks the plugin up from the suite directory name — no verifier
65
+ configuration is needed beyond the default busser verifier.
37
66
 
38
- Created and maintained by [Fletcher Nichol][author] (<fnichol@nichol.ca>)
67
+ ## Using it with Test Kitchen
39
68
 
40
- ## License
69
+ This is how most people run it, and it needs no Busser commands of your own.
70
+ Select the verifier in `kitchen.yml`:
71
+
72
+ ```yaml
73
+ verifier:
74
+ name: busser
75
+
76
+ suites:
77
+ - name: default
78
+ ```
79
+
80
+ Then put your tests in a `bats` directory inside the suite:
41
81
 
42
- Apache 2.0 (see [LICENSE][license])
82
+ ```text
83
+ test/integration/default/bats/default.bats
84
+ ```
43
85
 
44
- [Bats][bats_site] is released under an MIT-style license, copyright Sam Stephenson.
86
+ `kitchen verify` installs Busser and this plugin on the instance and runs them.
87
+ The directory name is what selects this plugin -- there is nothing else to
88
+ configure.
89
+
90
+ ## When nothing runs
91
+
92
+ If the suite files do not match what this plugin looks for, the run prints one
93
+ line and **exits `0`**:
94
+
95
+ ```text
96
+ -----> Running bats test suite
97
+ ```
98
+
99
+ No tests ran, and nothing said so. Work through these in order:
100
+
101
+ 1. **Is the directory named `bats`?** That name alone selects this plugin.
102
+ `batss/`, `tests/` or anything else is not picked up.
103
+ 2. **Do the filenames match?** Every `*.bats` file in the directory is run
104
+ -- `smoke.sh` is *not* picked up.
105
+ 3. **Is the plugin installed?** `busser plugin list` shows what is available.
106
+ 4. **Is `BUSSER_ROOT` what you think?** `busser suite path` prints where suites
107
+ are actually being looked for.
108
+
109
+ ## Contributing
110
+
111
+ Bug reports and pull requests are welcome. See
112
+ [CONTRIBUTING.md](CONTRIBUTING.md) for how to set up the project, run the test
113
+ suite, and format your commits.
114
+
115
+ ## License
45
116
 
117
+ Apache License 2.0. See [LICENSE](LICENSE).
46
118
 
47
- [author]: https://github.com/fnichol
48
- [issues]: https://github.com/fnichol/busser-bats/issues
49
- [license]: https://github.com/fnichol/busser-bats/blob/master/LICENSE
50
- [repo]: https://github.com/fnichol/busser-bats
119
+ The vendored copy of Bats is released under an MIT-style license, copyright Sam
120
+ Stephenson and the bats-core contributors.
51
121
 
52
- [bats_site]: https://github.com/sstephenson/bats
122
+ Originally created by [Fletcher Nichol](https://github.com/fnichol).
data/Rakefile CHANGED
@@ -1,12 +1,17 @@
1
1
  require "bundler/gem_tasks"
2
- require "open-uri"
3
-
4
2
  namespace :bats do
5
- version = ENV.fetch("BATS_VERSION", "v0.4.0")
6
- url = "https://github.com/sstephenson/bats/archive/#{version}.tar.gz"
3
+ # bats moved. sstephenson/bats was archived in 2016 at v0.4.0; bats-core is
4
+ # the maintained fork and where every release since has come from.
5
+ version = ENV.fetch("BATS_VERSION", "v1.14.0")
6
+ url = "https://github.com/bats-core/bats-core/archive/refs/tags/#{version}.tar.gz"
7
7
  tarball = "tmp/bats-#{version}.tar.gz"
8
8
  vendor = "vendor/bats"
9
9
 
10
+ # install.sh needs bin, libexec, lib and the two man pages. Everything else in
11
+ # the tarball -- the test suite, the docs site, Docker and CI scaffolding --
12
+ # is weight in a gem that gets copied onto every machine under test.
13
+ keep = %w{bin libexec lib man install.sh uninstall.sh LICENSE.md README.md}
14
+
10
15
  desc "Vendors bats #{version} source code into gem codebase"
11
16
  task vendor: "#{vendor}/VERSION.txt"
12
17
 
@@ -14,19 +19,16 @@ namespace :bats do
14
19
  directory vendor
15
20
 
16
21
  file tarball => File.dirname(tarball) do |t|
17
- src = open(url).binmode
18
- dst = open(t.name, "wb")
19
- IO.copy_stream(src, dst)
20
- ensure
21
- src.close
22
- dst.close
22
+ sh "curl", "--fail", "--silent", "--location", url, "--output", t.name
23
23
  end
24
24
 
25
25
  file "#{vendor}/VERSION.txt" => [vendor, tarball] do |t|
26
26
  abs_tarball = File.expand_path(tarball)
27
- Dir.chdir(vendor) { sh "tar xzf #{abs_tarball} --strip-components=1" }
28
- rm_rf "#{vendor}/test"
29
- IO.write(t.name, url + "\n")
27
+ Dir.chdir(vendor) do
28
+ sh "tar", "xzf", abs_tarball, "--strip-components=1"
29
+ (Dir.glob("*", File::FNM_DOTMATCH) - [".", "..", *keep]).each { |f| rm_rf(f) }
30
+ end
31
+ File.write(t.name, "#{url}\n")
30
32
  end
31
33
 
32
34
  desc "Clean up a vendored bats in preparation for a new vendored version"
@@ -35,20 +37,37 @@ namespace :bats do
35
37
  end
36
38
  end
37
39
 
40
+ require "rake/testtask"
41
+ Rake::TestTask.new(:unit) do |t|
42
+ t.libs.push "lib"
43
+ t.test_files = FileList["spec/**/*_spec.rb"]
44
+ t.verbose = true
45
+ end
46
+
38
47
  require "cucumber/rake/task"
39
48
  Cucumber::Rake::Task.new(:features) do |t|
40
- t.cucumber_opts = ["features", "-x", "--format progress"]
49
+ t.cucumber_opts = ["features", "--format progress", "--fail-fast"]
41
50
  end
42
51
 
43
- desc "Run all test suites"
44
- task test: [:features]
45
-
46
- desc "Display LOC stats"
47
- task :stats do
48
- puts "\n## Production Code Stats"
49
- sh "countloc -r lib"
50
- puts "\n## Test Code Stats"
51
- sh "countloc -r features"
52
+ # yard lives in the :development group, which CI omits when it runs the tests.
53
+ # Requiring it unconditionally would make `rake test` fail there, so the real
54
+ # task is only defined when yard is installed and a stub explains its absence
55
+ # otherwise. Nothing in CI gates on documentation.
56
+ begin
57
+ require "yard"
58
+
59
+ YARD::Rake::YardocTask.new(:doc) do |t|
60
+ t.files = ["lib/**/*.rb"]
61
+ t.options = ["--output-dir", "doc", "--markup", "markdown"]
62
+ end
63
+ rescue LoadError
64
+ desc "Generate YARD documentation (install the development group first)"
65
+ task :doc do
66
+ abort "yard is not available. Run `bundle install --with development` first."
67
+ end
52
68
  end
53
69
 
54
- task default: %i{test quality}
70
+ desc "Run all test suites"
71
+ task test: %i{unit features}
72
+
73
+ task default: %i{test}
data/busser-bats.gemspec CHANGED
@@ -1,22 +1,30 @@
1
1
  lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "busser/bats/version"
4
- require "English"
5
4
 
6
- Gem::Specification.new do |gem|
7
- gem.name = "busser-bats"
8
- gem.version = Busser::Bats::VERSION
9
- gem.authors = ["Fletcher Nichol"]
10
- gem.email = ["fnichol@nichol.ca"]
11
- gem.description = "A Busser runner plugin for Bats"
12
- gem.summary = gem.description
13
- gem.homepage = "https://github.com/test-kitchen/busser-bats"
14
- gem.license = "Apache 2.0"
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "busser-bats"
7
+ spec.version = Busser::Bats::VERSION
8
+ spec.authors = ["Fletcher Nichol"]
9
+ spec.email = ["fnichol@nichol.ca"]
10
+ spec.description = "A Busser runner plugin for Bats"
11
+ spec.summary = spec.description
12
+ spec.homepage = "https://github.com/test-kitchen/busser-bats"
13
+ spec.license = "Apache-2.0"
15
14
 
16
- gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
- gem.executables = []
18
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ["lib"]
15
+ spec.required_ruby_version = ">= 3.2"
20
16
 
21
- gem.add_dependency "busser"
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = []
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.metadata = {
22
+ "bug_tracker_uri" => "#{spec.homepage}/issues",
23
+ "changelog_uri" => "#{spec.homepage}/blob/main/CHANGELOG.md",
24
+ "documentation_uri" => "#{spec.homepage}/blob/main/README.md",
25
+ "homepage_uri" => spec.homepage,
26
+ "source_code_uri" => spec.homepage,
27
+ }
28
+
29
+ spec.add_dependency "busser", ">= 0.9.0"
22
30
  end
@@ -1,11 +1,6 @@
1
1
  require "aruba/cucumber"
2
2
  require "busser/cucumber"
3
3
 
4
- if ENV["COVERAGE"]
5
- require "simplecov"
6
- SimpleCov.command_name "features"
7
- end
8
-
9
4
  Before do
10
5
  @aruba_timeout_seconds = 20
11
6
  end