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

TestTask when --verbose prompts for TESTOPTS="--verbose" #151

Merged
merged 2 commits into from
Aug 4, 2016
Merged

TestTask when --verbose prompts for TESTOPTS="--verbose" #151

merged 2 commits into from
Aug 4, 2016

Conversation

MarkDBlackwell
Copy link
Contributor

@MarkDBlackwell MarkDBlackwell commented Jul 30, 2016

CASE

Originally, Jim Weirich developed Rake to work with (arguably) Test::Unit, before the arrival of Minitest. And none of the following gems:

  • Cucumber
  • RSpec
  • Test::Unit

(used for testing) prompts the user to rerun their tests with a --verbose command line option.

Minitest (somewhat newer) does so prompt the user—it (sometimes) emits the message: "You have skipped tests. Run with --verbose for details." Under Rake, this message is somewhat confusing. This has been reported (see below).

Rake's own test suite employs Minitest. When tests are skipped (as on Windows), it also displays this problem (i.e., Minitest emits the above, confusing message).

In a Rails issue, Adding --verbose flag to rake test doesn't do anything (closed), @cannikin says:

Maybe the Rake test output should be updated to mention [TESTOPTS='v'] instead of --verbose? I know the message is coming from Minitest, which doesn't know/care that it's running inside a Rake task, but I doubt the average person running tests from the console would know that.

In an (earlier) article, Rails Tip: Running Tests with Verbose Output, @peter says:

It took me a while to track down the TESTOPTS argument.

Overall, it would seem good to improve the ease (for new users) of using Rake's TestTask.

PLAN

In @shunsuke227ono's Minitest pull request, add summary message for case that minitest is used from rake task (closed), @zenspider commented:

I'm not sure I agree with the sentiment of this PR. What about all the other ways that tests might be run? I don't think minitest should try to cover them all. It is the responsibility of the developer to know their tools, not minitest.

It seems possible (though elaborately difficult) for Rake to detect Minitest (despite its being run in a forked shell command).

But to avoid all that (major) trouble, simply instead supplying a printed reminder to use TESTOPTS="--verbose" would seem able to clarify this (for new users), as well as to resolve this misleading information apparently printed by a Rake test task.

To minimize output, this should be printed only when running a Rake TestTask in --verbose mode (e.g., when the user already has tried the apparent, Minitest-recommended solution of adding --verbose).

This supplies the printed reminder (and adds tests). It ameliorates the issue of pull request #67 (which effectively was reverted).

@hsbt
Copy link
Member

hsbt commented Jul 30, 2016

I against to show this message when set to verbose = true. I'm ok to only show when user invoke rake task with --verbose option.

@MarkDBlackwell
Copy link
Contributor Author

MarkDBlackwell commented Aug 1, 2016

Objection addressed here—and tested here.

@hsbt
Copy link
Member

hsbt commented Aug 4, 2016

Looks good. Thanks.

@hsbt hsbt merged commit 93e7ba2 into ruby:master Aug 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants