I can't find it in the existing article (maybe it's just a bad search), and it was difficult to find it in the reference, so I will write it as an article.
If you are developing a gem and want to run tests
rake test
And it is sufficient. Oops, as a prerequisite
bundle gem hoge
Let's use a gem with a typical configuration made as follows.
What if you want to run only a specific test file? You can specify the file as follows.
rake test TEST=path/to/some_test.rb
This is the official Ruby reference class Rake :: TestTask (Ruby 2.7.0 Reference Manual) It was written as "Example of using test target". Hmmm, but it's quite difficult to get to this page. Besides, there is no explanation, only one line is posted as an "example".
In my experiments, it seemed that wildcards could be used to specify TEST
.
Therefore, if it is troublesome to write directories and extensions
rake test TEST=**/*/some_test*
It can also be done like this.
By the way, in the case of gem made with bundle gem hoge
, test
is the default task, so test
is abbreviated.
rake TEST=**/*/some_test*
You can also write.
Recommended Posts