RSpec logfmt Formatter
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_formatterUse it:
rspec --format RspecLogfmtFormatter --out rspec.txtYou'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 --out rspec.txtUsing 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"
endPut the same arguments as the commands above in your .rspec:
--format RspecLogfmtFormatter --out rspec.txtParallel tests
You can sum repeated values in one file using rspec_logfmt_formatter_collate rspec.txt.
It will rewrite a file like:
tests.count="3"
tests.count="1"
into:
tests.count="4"
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 --out $BUILDEVENT_FILEDevelopment
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.
- Ensure your
~/.gem/credentialsare correct - Update the CHANGELOG.md
- Update the version.rb
- Run
bundle exec rake upload - Check the tag was pushed and the new version was released
License
The MIT License, see LICENSE.