Tests fail b/c RSpec improved the way they parse options.
Opened this issue · 6 comments
- An explanation is here.
- Downside: we have to bump versions if we bump dependencies.
- Upside: their new approach is way better.
- If we bump version, evaluate whether we should remove the dep on error 2 communicate since I have little intent to maintain it.
Hi, is this gem still maintained? I'm very interested in it, but open issues like this one suggest that perhaps it no longer works with recent versions of rspec?
I haven't done much with it since I stopped teaching. I used to use it b/c students were taught minitest first and it doesn't have a runner. This allowed me to use RSpec's runner... plus, I just thought it was an interesting challenge.
I'd guess that it'd take me somewhere between 2 hours and 2 days to get it up to date with the latest versions. The main tiring aspect of it is that it has to do some deeply questionable things to get everything to work. Like it really knows a lot about the guts of both Minitest and RSpec, hence its fragility. As they improve things like this, though, maybe I can remove some of that nonsense. The other tiring bit is that I want good error messages, but the error reporting lib I was working on is the kind of thing that will get arbitrarily complex. Again, if I was still teaching, it would feel worthwhile (b/c it would automate heuristics for students so they don't get stuck on pointless dumb things that don't make sense without experience). But since I'm not, and that lib is endless, it's just easier to rely on my own understanding. So, if I were to maintain mrspec, I'd probably drop the dep on e2c.
Anyway, if you let me know your use case, I can advise you wrt adding a dep on this.
OK, thanks for the quick response and feedback! This may not be a great solution, which is fine.
I have a project I started years ago for which I used minitest for testing, but now regret it and want to switch to rspec. This could be a very painless way to do it, allowing me to have a mixture of rspec and minitest tests in my project, as I add new ones in rspec, and perhaps slowly convert the old ones. With nice integrated output still. Googling for ideas of how to handle my needs, I came across this.
But if it's super hacky to get it to work, may not be worth it. Another option is of course just always running both minitest and rspec when I run tests, with segregated output in the console/log.
Okay. In that case, it will probably work, as is, as an intermediate solution. Meaning you could add a dep on whatever RSpec mrspec works for. Then use mrspec to run both. As you work in the Minitest files, translate them to RSpec. After some time, they'll be all RSpec. At that point, drop the dep on mrspec. Then update the RSpec dep to the latest one. Hopefully that'll give you some immediate wins and a gradient to to what you want without requiring a big up-front investment.
Another possibility is to use a parser to rewrite your test files. I've done this with the Parser gem, but Ryan Davis also has a parser gem (on my phone or I'd look it up, but it's like "ruby_parse" or "parse_ruby" or smth) and there's also one in the stdlib called Ripper. If you look through the issues on my project seeing_is_believing, there's probably a small example somewhere about how to do this sort of thing. I do it in that lib, but there's a lot going on, so it's probably not easy to extract (actually, if you start in the file like "wrap_expressions.rb" or smth, you can prob figure it out).
Hmm. I don't want to write my new rspec files to an old version of rspec though, defeats the purpose of trying to get up to date. :)
Someone else has actually provided a Parser-based translator, I'm exploring that too. I'm not optimistic about it leaving legible source without human editing of each file (for one thing it removes all comments), but it's another option, yup. https://github.com/jaredbeck/minitest_to_rspec
Just having a CI task that runs minitest and rspec separately is of course the simplest option, but leads to somewhat confusing output and possibly code.
I've also learned through experience not to count on "After some time, they'll be all RSpec." unless I actualy drop other things to work on it until it's so now. :)