Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 0011ab8

Browse files
committed
docs: emphasize gem backtrace exclusion patterns
1 parent c22e902 commit 0011ab8

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

features/configuration/backtrace_exclusion_patterns.feature

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
Feature: Excluding lines from the backtrace
22

3-
To reduce the noise when diagnosing failures, RSpec excludes matching lines
4-
from backtraces. The default exclusion patterns are:
3+
To reduce the noise when diagnosing failures, RSpec can exclude lines
4+
belonging to certain gems or matching given patterns.
55

6+
If you want to filter out backtrace lines belonging to specific gems, you can
7+
use `config.filter_gems_from_backtrace` like so:
8+
```ruby
9+
config.filter_gems_from_backtrace "ignored_gem", "another_ignored_gem",
10+
```
11+
12+
For more control over which lines to ignore, you can use the the
13+
`backtrace_exclusion_patterns` option to either replace the default exclusion
14+
patterns, or append your own, e.g.
15+
```ruby
16+
config.backtrace_exclusion_patterns = [/first pattern/, /second pattern/]
17+
config.backtrace_exclusion_patterns << /another pattern/
18+
```
19+
20+
The default exclusion patterns are:
621
```ruby
722
/\/lib\d*\/ruby\//,
823
/org\/jruby\//,
924
/bin\//,
1025
/lib\/rspec\/(core|expectations|matchers|mocks)/
1126
```
1227
13-
This list can be modified or replaced with the `backtrace_exclusion_patterns`
14-
option. Additionally, `rspec` can be run with the `--backtrace` option to skip
28+
Additionally, `rspec` can be run with the `--backtrace` option to skip
1529
backtrace cleaning entirely.
1630
17-
In addition, if you want to filter out backtrace lines from specific gems, you
18-
can use `config.filter_gems_from_backtrace`.
19-
2031
Scenario: Using default `backtrace_exclusion_patterns`
2132
Given a file named "spec/failing_spec.rb" with:
2233
"""ruby

0 commit comments

Comments
 (0)