Module | SimpleCov::Configuration |
In: |
lib/simplecov/configuration.rb
|
filters | [W] | |
formatter | [W] | |
groups | [W] |
Add a filter to the processing chain. There are four ways to define a filter:
SimpleCov.add_filter 'app/models' # will reject all your models
SimpleCov.add_filter do |src_file| File.basename(src_file.filename) == 'environment.rb' end # Will exclude environment.rb files from the results
SimpleCov.add_filter ['app/models', 'app/helpers'] # ignores both dirs
Define a group for files. Works similar to add_filter, only that the first argument is the desired group name and files PASSING the filter end up in the group (while filters exclude when the filter is applicable).
Gets or sets the behavior to process coverage results.
By default, it will call SimpleCov.result.format!
Configure with:
SimpleCov.at_exit do puts "Coverage done" SimpleCov.result.format! end
The name of the command (a.k.a. Test Suite) currently running. Used for result merging and caching. It first tries to make a guess based upon the command line arguments the current test suite is running on and should automatically detect unit tests, functional tests, integration tests, rpsec and cucumber and label them properly. If it fails to recognize the current command, the command name is set to the shell command that the current suite is running on.
You can specify it manually with SimpleCov.command_name("test:units") - please also check out the corresponding section in README.rdoc
The name of the output and cache directory. Defaults to ‘coverage‘
Configure with SimpleCov.coverage_dir(‘cov’)
Returns the full path to the output directory using SimpleCov.root and SimpleCov.coverage_dir, so you can adjust this by configuring those values. Will create the directory if it‘s missing
Gets or sets the configured formatter.
Configure with: SimpleCov.formatter(SimpleCov::Formatter::SimpleFormatter)
Defines the maximum coverage drop at once allowed for the testsuite to pass. SimpleCov will return non-zero if the coverage decreases by more than this threshold.
Default is 100% (disabled)
Defines the maximum age (in seconds) of a resultset to still be included in merged results. i.e. If you run cucumber features, then later rake test, if the stored cucumber resultset is more seconds ago than specified here, it won‘t be taken into account when merging (and is also purged from the resultset cache)
Of course, this only applies when merging is active (e.g. SimpleCov.use_merging is not false!)
Default is 600 seconds (10 minutes)
Configure with SimpleCov.merge_timeout(3600) # 1hr
Defines the minimum overall coverage required for the testsuite to pass. SimpleCov will return non-zero if the current coverage is below this threshold.
Default is 0% (disabled)
Defines the minimum coverage per file required for the testsuite to pass. SimpleCov will return non-zero if the current coverage of the least covered file is below this threshold.
Default is 0% (disabled)
Certain code blocks (i.e. Ruby-implementation specific code) can be excluded from the coverage metrics by wrapping it inside # :nocov: comment blocks. The nocov token can be configured to be any other string using this.
Configure with SimpleCov.nocov_token(‘skip’) or it‘s alias SimpleCov.skip_token(‘skip’)
Refuses any coverage drop. That is, coverage is only allowed to increase. SimpleCov will return non-zero if the coverage decreases.
The root for the project. This defaults to the current working directory.
Configure with SimpleCov.root(’/my/project/path’)
Coverage results will always include files matched by this glob, whether or not they were explicitly required. Without this, un-required files will not be present in the final report.