-
Notifications
You must be signed in to change notification settings - Fork 553
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
Recurse upward looking for .simplecov #423
Conversation
Prior art:
This behaviour seems ok, but I think I'd want RSpec to be consistent (since they're so often used together). |
@xaviershay Note that the testing process for a Ruby project is very unlikely to involve running RSpec multiple times, from different subdirectories. This patch was prompted by work being done on Racc. Its test suite runs the I think that this usecase is not entirely unique to Racc. Many test suites may run Ruby subprocesses, for one reason or another. Those subprocesses may or may not have the same working directory. |
The SimpleCov documentation states: "To avoid [duplicated configuration], you can place a file called .simplecov in your project root." However, SimpleCov did not actually look in the "project root" for this file, unless specially configured to know where the project root is. Rather, it would simply look in the working directory. Working directory != project root. (Unfortunately.) Therefore, when looking for .simplecov, recurse upwards from the working directory until it is found (or the root directory is reached). This is comparable to the way that git recurses upwards looking for a .git directory, meaning that you can use git anywhere in your project root or below. Since there is no guarantee that you have permissions to read .simplecov, catch exceptions and display a warning message if one occurs.
Fixed up the style errors. |
Last chance for comment, I'm going to merge this later today otherwise. |
Recurse upward looking for .simplecov
0.11.0 2015-11-29 ([changes](simplecov-ruby/simplecov@v0.10.0...v0.10.11)) ================= ## Enhancements * Added `SimpleCov.minimum_coverage_by_file` for per-file coverage thresholds. See [#392](simplecov-ruby/simplecov#392) (thanks @ptashman) * Added `track_files` configuration option to specify a glob to always include in coverage results, whether or not those files are required. See [#422](simplecov-ruby/simplecov#422) (thanks @hugopeixoto) * Speed up `root_filter` by an order of magnitude. See [#396](simplecov-ruby/simplecov#396) (thanks @raszi) ## Bugfixes * Fix warning about global variable `$ERROR_INFO`. See [#400](simplecov-ruby/simplecov#400) (thanks @amatsuda) * Actually recurse upward looking for `.simplecov`, as claimed by the documentation, rather than only the working directory. See [#423](simplecov-ruby/simplecov#423) (thanks @alexdowad)
The SimpleCov documentation states: "To avoid [duplicated configuration], you
can place a file called
.simplecov
in your project root." However, SimpleCov didnot actually look in the "project root" for this file, unless specially configured
to know where the project root is. Rather, it would simply look in the working
directory. Working directory != project root. (Unfortunately.)
Therefore, when looking for
.simplecov
, recurse upwards from the working directoryuntil it is found (or the root directory is reached). This is comparable to the
way that git recurses upwards looking for a .git directory, meaning that you can
use git anywhere in your project root or below.
Since there is no guarantee that you have permissions to read
.simplecov
, catchexceptions and display a warning message if one occurs.