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
Mocha is incompatible with minitest v5.19 and later #614
Comments
Thanks for the heads up, although I'm a bit confused about what's broken. I just manually ran the weekly build which tries to pick up on incompatibilities like this, but nothing failed even though the job using the latest Minitest gem seems to have used v5.19.0 which is the version you mention. If you understand more about exactly what the problem is, it would be great if you can save me some time and tell me what's actually broken and ideally what I need to change! |
And do you know if there was a Minitest deprecation warning for this? If so, I missed it! |
here's a backtrace if that's helpful:
|
You and I both 😛 . Not that I know of, no. I logged an issue asking for confirmation that minitest actually uses semver, because I've been operating under the assumption that it does. Hopefully this was just an oversight, but it's a good reminder that we're using pretty old API, here.
I'll see if I can work up a minimal reproducer for you. |
When I edited the gem locally to use the |
Yeah I just pinned minitest to < 5.19 for now. |
@floehopper run this: require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "minitest", "~> 5.19"
gem "mocha", "~> 2.0"
end
require "minitest/autorun"
require 'mocha/minitest' I see this:
Works fine with minitest < 5.19. |
Thanks for the backtrace - it certainly gives me a bit more to go on!
Did you rename all occurrences of |
@kyrofa Many thanks for the code to reproduce the problem 👍 |
I definitely appreciate that mindset, but it's worth a look at minitest. I'd be willing to bet the |
I just updated the one call in |
TODO: - [ ] Ideally I'd like to add a failing test to force me to make this change - [ ] Check that other occurrences of MiniTest aren't breaking things
Yes, that seems to do the trick for me too (I've opened #615 to demo that), although I think there might be a bunch of other stuff to check and definitely some code to clean up. If anyone has a project with a lot of tests that using Mocha, it would be great if you could point your # Gemfile
gem "mocha", github: "freerange/mocha", branch: "fix-minitest-compatibility" |
Looks like a 10 year old casing change: https://github.com/minitest/minitest/blob/master/History.rdoc#505--2013-06-20- |
no |
It turns out we were relying on the very old [1] MiniTest module name rather than the newer Minitest module name. While there are other places in the code that use the MiniTest form, most (all?) of those are internal to Mocha. Anyway making this one change seems to fix the problems people are having. Ideally I'd like to add a failing test to force me to make this change, but I don't have time right now and I want to fix the problem for people as soon as possible. It would also be good to do a general clean up of all the uses of MiniTest to make sure I haven't missed anything. Fixes #614. [1]: https://github.com/minitest/minitest/blob/master/History.rdoc#505--2013-06-20-
The mocha update is required to retain compatibility with minitest. See freerange/mocha#614 for more details.
Fix released in v2.1.0. Thanks for your help, @kyrofa, @manewitz & @zenspider. |
Thanks @floehopper, really appreciate it! |
It turns out we were relying on the very old [1] MiniTest module name rather than the newer Minitest module name. While there are other places in the code that use the MiniTest form, most (all?) of those are internal to Mocha. Anyway making this one change seems to fix the problems people are having. Ideally I'd like to add a failing test to force me to make this change, but I don't have time right now and I want to fix the problem for people as soon as possible. I've run this fix against a large test suite and the build passes [2], so it doesn't feel very risky releasing this. It would also be good to do a general clean up of all the uses of MiniTest to make sure I haven't missed anything. Fixes freerange#614. [1]: https://github.com/minitest/minitest/blob/master/History.rdoc#505--2013-06-20- [2]: alphagov/whitehall#8015
Mocha > v2.1.0 is needed to run with modern versions of Minitest. See freerange/mocha#614
All of these are either references to constants internal to Mocha or documentation referencing the Minitest library. As noted by @zenspider in this comment [1], the rename is over 10 years old, so it seems about time we update it! [1]: #614 (comment)
As noted by @zenspider in this comment [1], the rename is over 10 years old, so it seems about time we update it! [1]: #614 (comment)
As noted by @zenspider in this comment [1], the rename is over 10 years old, so it seems about time we update it! I've also renamed `test/mini_test_result.rb` -> `test/minitest_result_pre_v5.rb` to better explain its purpose. I did initially think about removing this, but we're still running pre v5 versions of Minitest in the CI builds for Ruby v2.0 & v2.1, so I'm going to leave that for now and address it separately. [1]: #614 (comment)
All of these are either references to constants internal to Mocha or documentation referencing the Minitest library. As noted by @zenspider in this comment [1], the rename is over 10 years old, so it seems about time we update it! [1]: #614 (comment)
As noted by @zenspider in this comment [1], the rename is over 10 years old, so it seems about time we update it! I've also renamed `test/mini_test_result.rb` -> `test/minitest_result_pre_v5.rb` to better explain its purpose. I did initially think about removing this, but we're still running pre v5 versions of Minitest in the CI builds for Ruby v2.0 & v2.1, so I'm going to leave that for now and address it separately. [1]: #614 (comment)
As noted by @zenspider in this comment [1], the rename is over 10 years old, so it seems about time we update it! I've also renamed `test/mini_test_result.rb` -> `test/minitest_result_pre_v5.rb` to better explain its purpose. I did initially think about removing this, but we're still running pre v5 versions of Minitest in the CI builds for Ruby v2.0 & v2.1, so I'm going to leave that for now and address it separately. [1]: #614 (comment)
All of these are either references to constants internal to Mocha or documentation referencing the Minitest library. As noted by @zenspider in this comment [1], the rename is over 10 years old, so it seems about time we update it! [1]: #614 (comment)
As noted by @zenspider in this comment [1], the rename is over 10 years old, so it seems about time we update it! I've also renamed `test/mini_test_result.rb` -> `test/minitest_result_pre_v5.rb` to better explain its purpose. I did initially think about removing this, but we're still running pre v5 versions of Minitest in the CI builds for Ruby v2.0 & v2.1, so I'm going to leave that for now and address it separately. [1]: #614 (comment)
* upgrade other dependencies * use current Ruby version for build
Minitest has removed the ancient MiniTest compatibility layer that Mocha has been relying on unless the user defines the
MT_COMPAT
environment variable. See the commit for more details.Seems that Mocha should move to using
Minitest
instead?The text was updated successfully, but these errors were encountered: