Is there a way to trigger RSpec test case collection, but not run the tests?
In Python's pytest, the equivalent is appending a --collect-only switch.
My use case: I would like to run a hook that validates some metadata about our test cases, such as enforcing a mandatory tagging pattern, and I'd like to include this validation check as a PR check. The issue is, I don't really want the test suite to run, but I would only like to validate test case metadata.
Any help would be appreciated and thank you in advance!
There seems to be no built-in way to do collection only. Instead, I had to add the following in my
spec_helper. Basically, skip the test if you pass in an environment variableCONTEXT=validateinto your test run. Not really a great way to do this but it seems RSpec provides no built-in alternative: