Shopify/tapioca

`bundle exec tapioca gems --all` calls minitest internally and fails due to invalid option "-all"

ric2b opened this issue · 2 comments

Running tapioca gems --all is returning an error code even though it does still update rbi files.

This is a problem for scripting/automation (in this case automatically regenerating gem rbi files on PR's that touch Gemfile.lock)

From the output it looks like somehow tapioca is passing the -all to minitest? This project doesn't even use minitest, it uses rspec. minitest is only included as a transitive dependency of activesupport.

$ bundle exec tapioca gems --all
Requiring all gems to prepare for compiling... 
invalid option: --all

minitest options:
    -h, --help                       Display this help.
        --no-plugins                 Bypass minitest plugin auto-loading (or set $MT_NO_PLUGINS).
    -s, --seed SEED                  Sets random seed. Also via env. Eg: SEED=n rake
    -v, --verbose                    Verbose. Show progress processing files.
    -q, --quiet                      Quiet. Show no progress processing files.
        --show-skips                 Show skipped at the end of run.
    -n, --name PATTERN               Filter run on /regexp/ or string.
        --exclude PATTERN            Exclude /regexp/ or string from run.
    -S, --skip CODES                 Skip reporting of certain types of results (eg E).

Known extensions: simplecov, rails, pride
    -w, --warnings                   Run with Ruby warnings enabled
    -e, --environment ENV            Run tests in the ENV environment
    -b, --backtrace                  Show the complete backtrace
    -d, --defer-output               Output test failures and errors after the test run
    -f, --fail-fast                  Abort test run on first failure or error
    -c, --[no-]color                 Enable color in the output
    -p, --pride                      Pride. Show your testing pride!
Run options: gems --all --seed 5267

# Running:

You don't have dalli installed in your application. Please add it to your Gemfile and run bundle install
You don't have dalli installed in your application. Please add it to your Gemfile and run bundle install
 Done

Removing RBI files of gems that have been removed:

  Nothing to do.

  Compiled actiontext (empty output)
  Compiled Ascii85
   identical  sorbet/rbi/gems/actiontext@7.0.6.rbi
...

The minitest output happens a lot of times through the command execution and is also the last output from the command, hence my assumption that it is causing the error return code.

Software versions:

  • sorbet-static-and-runtime 0.5.11305
  • tapioca 0.13.1
  • ruby 3.3.0p0
  • bundler 2.5.1

sorbet/tapioca/require.rb file probably contains an entry that is loading minitest. We saw this before with require's such as require "rails/test_help". You can try removing that or similar test entries from require.rb.

Yup, that was it, removing 'rails/test_help' from require.rb fixed it, thanks! 🙌