-
-
Notifications
You must be signed in to change notification settings - Fork 158
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! |
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
The access token request needs the code if we're using code flow. Some providers require additional parameters such as grant_type and redirect_uri. Also, pin the minitest version per a conflict with mocha, as noted here: freerange/mocha#614
The access token request needs the code if we're using code flow. Some providers require additional parameters such as grant_type and redirect_uri. To run tests, pin the minitest version per a conflict with mocha, as noted here: freerange/mocha#614 But do not leave pinned as the gem fails to install under some rubies that previously succeeded. For example: net-imap-0.5.0 requires ruby version >= 3.1.0, which is incompatible with the current version, ruby 2.6.8p0 (jruby 9.3.7.0) Also, Set grant type explicitly when response type is code Setting the grant_type to :authorization_code in extra_token_params results in token requests with multiple grant types separated by commas, with authorization_code appended to the end, which results in invalid grant type error from the provider.
The access token request needs the code if we're using code flow. For authorization code flow, grant_type and redirect_uri are also required. To run tests, pin the minitest version per a conflict with mocha, as noted here: freerange/mocha#614 But do not leave pinned as the gem fails to install under some rubies that previously succeeded. For example: net-imap-0.5.0 requires ruby version >= 3.1.0, which is incompatible with the current version, ruby 2.6.8p0 (jruby 9.3.7.0)
The access token request needs the code if we're using code flow. For authorization code flow, grant_type and redirect_uri are also required. See https://docs.duendesoftware.com/identityserver/v7/reference/endpoints/token/ To run tests, pin the minitest version per a conflict with mocha, as noted here: freerange/mocha#614 But do not leave pinned as the gem fails to install under some rubies that previously succeeded. For example: net-imap-0.5.0 requires ruby version >= 3.1.0, which is incompatible with the current version, ruby 2.6.8p0 (jruby 9.3.7.0)
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: