Shopify / deprecation_toolkit

⚒Eliminate deprecations from your codebase ⚒
MIT License
454 stars 40 forks source link

How do you use the CIRecordHelper? #92

Closed scottjacobsen closed 8 months ago

scottjacobsen commented 8 months ago

I'm trying to use the CIRecordHelper when running my tests in parallel on circleci, but as far as I can tell all it does is raise this error.

https://github.com/Shopify/deprecation_toolkit/blob/4608447b320b3278449eeedca3b9d9bca337966b/lib/deprecation_toolkit/behaviors/ci_record_helper.rb#L21

So my test output looks like:

Failures:

  1) User bar is expected to eq "foo"
     Failure/Error: raise "#{HEADER} #{JSON.dump(to_output)}"

     RuntimeError:
       [DeprecationToolkit] {"/tmp/test-results/deprecations/models/user.yml":{"test_user_bar_is_expected_to_eq_\"foo\"":["DEPRECATION WARNING: /Users/scott/dev/portal/spec/models/user_spec.rb:588: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call\n/Users/scott/dev/portal/app/models/user.rb:151: warning: The called method `foo' is defined here\n"]}}
     # /Users/scott/.asdf/installs/ruby/2.7.7/lib/ruby/gems/2.7.0/gems/deprecation_toolkit-2.0.3/lib/deprecation_toolkit/behaviors/ci_record_helper.rb:21:in `trigger'
     # /Users/scott/.asdf/installs/ruby/2.7.7/lib/ruby/gems/2.7.0/gems/deprecation_toolkit-2.0.3/lib/deprecation_toolkit/test_triggerer.rb:9:in `trigger_deprecation_toolkit_behavior'
     # /Users/scott/.asdf/installs/ruby/2.7.7/lib/ruby/gems/2.7.0/gems/deprecation_toolkit-2.0.3/lib/deprecation_toolkit/rspec.rb:7:in `block (2 levels) in <main>'
     # /Users/scott/.asdf/installs/ruby/2.7.7/lib/ruby/gems/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
...

And no json file is written. What am I doing wrong?

scottjacobsen commented 8 months ago

Okay - I figured it out - you simply pass your rpsec output to the rake task. It wasn't clear from the instructions.