summaryrefslogtreecommitdiff
path: root/content/blog/2023/rspec-options.md
blob: 45e0c968a8ba0270256e0ef3c35e3e69f007cd22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
---
title: "Specimen control with RSpec's options"
categories:
- blog
abstract: RSpec got some cool options for setting what we will test
date: 2023-03-31T22:54:50+02:00
year: 2023
draft: false
tags:
- Ruby
- RSpec
- Engineering
---
Did you know that you can control which tests are run using RSpec's runner options? There are a few options I use every day:

- `--seed=` - random order of tests is done by generating a random number, a seed. You can force given order by passing in [seed value](https://rubydoc.info/github/rspec/rspec-core/RSpec%2FCore%2FConfiguration:seed). Great for repeating order from CI!
- `--only-failures` - only tests that failed in the previous run will be run. 
- `--fail-fast` - stop run after first encountering failure.

Today I also learned about `--bisect`, which, in a flaky suite, will find the minimal set of tests that will fail the suite. Magic!

You can find a lot more of such options on [Github](https://github.com/rspec/rspec-core/tree/main/features/command_line).