Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less truncation in RSpec errors #7244

Merged
merged 1 commit into from
May 5, 2023

Conversation

deivid-rodriguez
Copy link
Contributor

@deivid-rodriguez deivid-rodriguez commented May 5, 2023

This decreases the chances that useful parts of an error message are hidden, making it harder to see what the problem is.

For example, the error fixed by #7243 now would show up like this:

Failures:

  1) Dependabot::Cargo::FileUpdater::LockfileUpdater#updated_lockfile_content when updating the lockfile fails because an existing requirement is no good raises a helpful error
     Failure/Error:
       expect { updater.updated_lockfile_content }.
         to raise_error do |error|
           expect(error).to be_a(Dependabot::DependencyFileNotResolvable)
           expect(error.message).
             to include("version for the requirement `regex = \"^99.0.0\"`")
         end
     
       expected #<Dependabot::SharedHelpers::HelperSubprocessFailed: Updating crates.io index
       error: failed to select a version for the requirement `time = "=99.0.0"`
       candidate versions found which didn't match: 0.3.20, 0.3.19, 0.3.18, ...
       location searched: crates.io index
       required by package `dependabot v0.1.0 (/home/dependabot/dependabot-core/cargo/dependabot_tmp_dir)`
       perhaps a crate was updated and forgotten to be re-vendored?> to be a kind of Dependabot::DependencyFileNotResolvable
     # ./spec/dependabot/cargo/file_updater/lockfile_updater_spec.rb:98:in `block (5 levels) in <top (required)>'
     # /home/dependabot/dependabot-core/common/spec/spec_helper.rb:64:in `block (2 levels) in <top (required)>'
     # /home/dependabot/dependabot-core/omnibus/.bundle/ruby/3.1.0/gems/webmock-3.18.1/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'

Finished in 0.65461 seconds (files took 3.2 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/dependabot/cargo/file_updater/lockfile_updater_spec.rb:97 # Dependabot::Cargo::FileUpdater::LockfileUpdater#updated_lockfile_content when updating the lockfile fails because an existing requirement is no good raises a helpful error

The useful bit that makes the culprit easier to discover (time = "=99.0.0") is now displayed by default.

@deivid-rodriguez deivid-rodriguez requested a review from a team as a code owner May 5, 2023 12:34
@deivid-rodriguez deivid-rodriguez added the EE Engineering Efficiency label May 5, 2023
Copy link
Member

@landongrindheim landongrindheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯0️⃣

This decreases the chances that useful parts of an error message are
hidden, making it harder to see what the problem is.
@deivid-rodriguez deivid-rodriguez force-pushed the deivid-rodriguez/better-rspec-errors branch from de793cc to 6f99ab5 Compare May 5, 2023 13:48
@deivid-rodriguez deivid-rodriguez enabled auto-merge (squash) May 5, 2023 13:48
@deivid-rodriguez deivid-rodriguez merged commit c206f48 into main May 5, 2023
@deivid-rodriguez deivid-rodriguez deleted the deivid-rodriguez/better-rspec-errors branch May 5, 2023 14:13
brettfo pushed a commit to brettfo/dependabot-core that referenced this pull request Oct 11, 2023
This decreases the chances that useful parts of an error message are
hidden, making it harder to see what the problem is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EE Engineering Efficiency
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants