RSpec report failure outside tests to JUnit

171 views Asked by At

How do I configure rspec to report the absence of examples as a failure in the JUnit report?

To give you some context: I recently parallelized my rspec test suite using parallel_rspec. Doing so, I forgot to migrate a --require XYZ from the .rspec file to .rspec_parallel. As most of my specs started with require 'XYZ' on their own, I didn't notice the error right away. If one of the runners starts with a spec that does not have that include, it fails for some symbols not being defined (see here). However, the generated JUnit reports just state that there was no test being executed so that failing workers went unnoticed in our Jenkins.

I am quite certain that the lacking --require flag was breaking the runner, but I would like to catch if that should not have been the single cause. Therefore, how would I configure rspec to report "no tests" as a failure when using --format RspecJunitFormatter --out tmp/rspec.xml?

$ rspec --version
RSpec 3.7
  - rspec-core 3.7.1
  - rspec-expectations 3.7.0
  - rspec-mocks 3.7.0
  - rspec-support 3.7.1
0

There are 0 answers