Skip to content

carwow/rspec_logfmt_formatter

Repository files navigation

RSpec logfmt Formatter

CircleCI Gem Version

RSpec 3 results in the logfmt format that you can push to your observability tool such as Honeycomb

Usage

Install the gem:

gem install rspec_logfmt_formatter

Use it:

rspec --format RspecLogfmtFormatter::Formatter --out rspec.txt

You'll get a file rspec.txt with your results in it.

You can use it in combination with other formatters, too:

rspec --format progress --format RspecLogfmtFormatter::Formatter --out rspec.txt

Using in your project with Bundler

Add it to your Gemfile if you're using Bundler. Put it in the same groups as rspec.

group :test do
  gem "rspec"
  gem "rspec_logfmt_formatter"
end

Put the same arguments as the commands above in your .rspec:

--format RspecLogfmtFormatter::Formatter
--out rspec.txt

Parallel tests

For use with parallel_tests, add $TEST_ENV_NUMBER in the output file option (in .rspec or .rspec_parallel) to avoid concurrent process write conflicts.

--format RspecLogfmtFormatter::Formatter
--out tmp/rspec<%= ENV["TEST_ENV_NUMBER"] %>.txt

How to push to Honeycomb

There are many ways you can push this to honeycomb. One way is to use the buildevents binary. Then output your spec output to BUILDEVENT_FILE e.g.

bundle exec rspec --format RspecLogfmtFormatter::Formatter --out $BUILDEVENT_FILE

Development

Pull the repo and run bundle install, the specs are run with bundle exec rspec and make sure to read the CONTRIBUTING.md.

Releasing

Currently this is a manual process and can only be run by a carwow developer.

  1. Ensure your ~/.gem/credentials are correct
  2. Update the CHANGELOG.md
  3. Update the version.rb
  4. Run bundle exec rake upload
  5. Check the tag was pushed and the new version was released

License

The MIT License, see LICENSE.

About

RSpec formatter that honeycomb can read

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages