This repository was archived by the owner on Nov 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 753
Improve logic that finds the failure line to print. #2088
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Introduce `project_source_dirs` config setting. - Look for the first backtrace line in one of the `project_source_dirs` rather than the first line from your spec file. This helps in situations where you define a helper method in a support file that has a failing expectation, and call it from your spec. Previously it would have shown the helper method call site rather than the expectation in the helper method itself. - If no backtrace line can be found in a `project_source_dirs`, pick the first backtrace line. While we don’t generally want to show lines from gems, it’s better than showing no line at all. Fixes #1991.
3a38db5
to
aadd339
Compare
As of rspec/rspec-support#245, `rspec/support/ruby_features` relies upon `rspec/support` being loaded first.
For some reason, this `load` wasn’t working as written on JRuby.
This is green -- anyone from @rspec/rspec want to review it? |
and exclude("raise(AssertionFailed, msg)") | ||
end | ||
|
||
it "falls back to finding a line in a gem when there are no backtrace lines in the app, lib or spec directories" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat
LGTM, didn't notice anything to improve. |
myronmarston
added a commit
that referenced
this pull request
Oct 14, 2015
Improve logic that finds the failure line to print.
myronmarston
added a commit
to myronmarston/rspec-given
that referenced
this pull request
Jan 12, 2016
RSpec changed how it detects source lines to print in rspec/rspec-core#2088, which necessitates us configuring `project_source_dirs` for our specs. (This should not affect end-users). In addition, we now print multi-line code snippets as of rspec/rspec-core#2083. Multiline snippets are not printed on the same line as `Failure/Error:` so our regex has to be updated to accommodate a line break.
searls
pushed a commit
to rspec-given/rspec-given
that referenced
this pull request
Jan 14, 2016
RSpec changed how it detects source lines to print in rspec/rspec-core#2088, which necessitates us configuring `project_source_dirs` for our specs. (This should not affect end-users). In addition, we now print multi-line code snippets as of rspec/rspec-core#2083. Multiline snippets are not printed on the same line as `Failure/Error:` so our regex has to be updated to accommodate a line break.
MatheusRich
pushed a commit
to MatheusRich/rspec-core
that referenced
this pull request
Oct 30, 2020
Improve logic that finds the failure line to print.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
project_source_dirs
config setting.project_source_dirs
rather than the first linefrom your spec file. This helps in situations where
you define a helper method in a support file that
has a failing expectation, and call it from your
spec. Previously it would have shown the helper
method call site rather than the expectation in
the helper method itself.
project_source_dirs
, pick the first backtraceline. While we don’t generally want to show lines
from gems, it’s better than showing no line at all.
Fixes #1991.