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

v5.19's removal of MiniTest compatiblity layer broke Mocha #960

Closed
kyrofa opened this issue Jul 26, 2023 · 5 comments
Closed

v5.19's removal of MiniTest compatiblity layer broke Mocha #960

kyrofa opened this issue Jul 26, 2023 · 5 comments

Comments

@kyrofa
Copy link

kyrofa commented Jul 26, 2023

See freerange/mocha#614 . I appreciate the MT_COMPAT environment variable, but that's still an API break, and it broke a number of our projects before we found what was happening. Any reason this wasn't done in a major version bump? Or does minitest not use semantic versioning?

@zenspider
Copy link
Collaborator

@matejzero
Copy link

I'm seeing the same with puppet's beaker tests:

An error occurred while loading ./spec/acceptance/class_spec.rb.
Failure/Error: require 'beaker'
NameError:
  uninitialized constant MiniTest
  Did you mean?  Minitest
...

@pgundlupetvenkatesh
Copy link

I got this with Minitest Spec

<path>/Ruby32-x64/lib/ruby/gems/3.2.0/gems/minitest-hooks-1.5.0/lib/minitest/hooks/default.rb:3:in `<top (required)>': uninitialized constant MiniTest (NameError)

MiniTest::Spec.register_spec_type(//, Minitest::HooksSpec)
        ^^^^^^
Did you mean?  Minitest
        from <internal:<path>/Ruby32-x64/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:<path>/Ruby32-x64/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'

Workaround - Downgrading Minitest to v5.18.1 works for now.

@kyrofa
Copy link
Author

kyrofa commented Jul 27, 2023

@zenspider that's a little disingenuous. Yes, Minitest has been around for a long time, but MiniTest has been stable and never caused deprecation warnings, so old gems of course are still using it-- what would cause them to update?

To be clear, I have zero issue with this API change. My problem is that it was shipped without a major version bump, which breaks applications with even pessimistic dependency versions (e.g. gem 'minitest', '~> 5.16'). Semantic versioning is a contract between maintainers and users; a way to give maintainers the freedom to make changes like this as they see fit while communicating them to users and giving them a chance to opt in to those updates (and update their code) as needed and on their schedule.

Which makes me ask again: does minitest use semantic versioning? Or should we be locking our minitest dependency versions down?

@zenspider
Copy link
Collaborator

"Disingenuous" is titling this issue "removal of MiniTest compatiblity layer".

Mocha has known about the name change for over a decade and yet persists (even after doing a "fix" today) on using the old namespace.

Real fix:

  1. Don't use MiniTest.

Legitimate workarounds:

  1. export MT_COMPAT=1
  2. `require "minitest/unit" in your test_helper / whereever.
  3. and I suppose pinning back to 5.18.1 if you have some esoteric reason why you can't do any of the others.

@minitest minitest locked as too heated and limited conversation to collaborators Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants