Skip to content
New issue

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

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

Already on GitHub? # to your account

Forward verbosity and filter time out of snapshot tests #865

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

suaviloquence
Copy link
Contributor

Improvements/fixes for the stdout/stderr of a snapshot test.

  1. Forward verbosity argument from clap args into GlobalConfig
  2. Filter [ x.xxxs] time strings from stdout and stderr for reproducible snapshots
Example output run on the `only_warnings` test crate
---
source: src/snapshot_tests.rs
expression: result
---
success: true
--- stdout ---

--- warning function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.34.0/src/lints/function_missing.ron

Failed in:
  function only_warnings::function_missing, previously in file /home/m/dev/cargo-semver-checks/test_crates/manifest_tests/only_warnings/old/src/lib.rs:4

--- stderr ---
     Parsing only-warnings v0.1.0 (current)
      Parsed [TIME] (current)
     Parsing only-warnings v0.1.0 (baseline)
      Parsed [TIME] (baseline)
    Checking only-warnings v0.1.0 -> v0.1.0 (no change)
     Checked [TIME] 80 checks: 79 pass, 0 fail, 1 warn, 0 skip

     Summary no semver update required
     Warning produced 1 major and 0 minor level warnings
             produced warnings suggest new major version
    Finished [TIME] only-warnings

This is technically two changes in a PR - I can break it up if you'd like, but both changes are very small.

Copy link
Owner

@obi1kenobi obi1kenobi left a comment

Choose a reason for hiding this comment

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

This part might need additional filtering: Checked [TIME] 80 checks: 79 pass, 0 fail, 1 warn, 0 skip

Otherwise, each new added lint will break it since it'll increment the check count and the pass count. I think masking both of those out should be fine — tests care about the number of fail/warn/skip, not the total lint count.

It's fine to do this in a separate PR, I'll merge this since it's a good change already.

@obi1kenobi obi1kenobi merged commit eb5c87d into obi1kenobi:main Aug 16, 2024
33 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants