0.11
No release in over a year
Formatter for RSpec to show errors in GitHub action annotations
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.0
~> 1.12.0
~> 1.4.0

Runtime

 Project Readme

Rspec::Github

CI Gem Version

RSpec formatter compatible with GitHub Action's annotations. It supports multiline errors and will set pending specs as warnings:

screenshot.png

Installation

Add the gem to your application's Gemfile test group:

group :test do
  gem 'rspec-github', require: false
end

And then of course install the gem by executing:

bundle install

Usage

You can specify the formatter with a command line argument:

rspec --format RSpec::Github::Formatter

And to always run it with this formatter, you can set it in the .rspec file:

# other configuration
--format RSpec::Github::Formatter

And to register the formatter in configuration, you can add the following to spec/spec_helper.rb:

RSpec.configure do |config|
  # Use the GitHub Annotations formatter for CI
  if ENV['GITHUB_ACTIONS'] == 'true'
    require 'rspec/github'
    config.add_formatter RSpec::Github::Formatter
  end
end

Note that you can select multiple formatters so that you can also see other output:

rspec --format RSpec::Github::Formatter --format progress
rspec --format RSpec::Github::Formatter --format documentation

If you want to disable annotations for pending specs you can do that by adding --tag ~skip to your command:

rspec --format RSpec::Github::Formatter --tag ~skip

Development

After checking out the repo, run bundle install to install dependencies. Then, run rake spec to run the tests. Publishing a new version is handled by the publish workflow. This workflow publishes a GitHub release to rubygems with the version defined in the release.

Usefull references

License

The gem is available as open source under the terms of the MIT License.