Git Product home page Git Product logo

coveralls-ruby's Introduction

coveralls-ruby Test Coverage Build Status Gem Version

Coveralls.io was designed with Ruby projects in mind, so we've made it as easy as possible to get started using Coveralls with Ruby and Rails project.

PREREQUISITES

Please note that SimpleCov only supports Ruby 1.9 and later.

INSTALLING THE GEM

You shouldn't need more than a quick change to get your project on Coveralls. Just include coveralls-ruby in your project's Gemfile like so:

# ./Gemfile

gem 'coveralls', require: false

While SimpleCov only supports Ruby 1.9+, using the Coveralls gem will not fail builds on earlier Rubies or other flavors of Ruby.

CONFIGURATION

coveralls-ruby uses an optional .coveralls.yml file at the root level of your repository to configure options.

The option repo_token (found on your repository's page on Coveralls) is used to specify which project on Coveralls your project maps to.

Another important configuration option is service_name, which indicates your CI service and allows you to specify where Coveralls should look to find additional information about your builds. This can be any string, but using the appropriate string for your service may allow Coveralls to perform service-specific actions like fetching branch data and commenting on pull requests.

Example: A .coveralls.yml file configured for Travis Pro:

service_name: travis-pro

Example: Passing repo_token from the command line:

COVERALLS_REPO_TOKEN=asdfasdf bundle exec rspec spec

TEST SUITE SETUP

After configuration, the next step is to add coveralls-ruby to your test suite.

For a Ruby app:

# ./spec/spec_helper.rb
# ./test/test_helper.rb
# ..etc..

require 'coveralls'
Coveralls.wear!

For a Rails app:

require 'coveralls'
Coveralls.wear!('rails')

Note: The Coveralls.wear! must occur before any of your application code is required, so it should be at the very top of your spec_helper.rb, test_helper.rb, or env.rb, etc.

And holy moly, you're done!

Next time your project is built on CI, SimpleCov will dial up Coveralls.io and send the hot details on your code coverage.

SIMPLECOV CUSTOMIZATION

"But wait!" you're saying, "I already use SimpleCov, and I have some custom settings! Are you really just overriding everything I've already set up?"

Good news, just use this gem's SimpleCov formatter directly:

require 'simplecov'
require 'coveralls'

SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.start do
  add_filter 'app/secrets'
end

Or alongside another formatter, like so:

require 'simplecov'
require 'coveralls'

SimpleCov.formatters = [
  SimpleCov::Formatter::HTMLFormatter,
  Coveralls::SimpleCov::Formatter
]
SimpleCov.start

MERGING MULTIPLE TEST SUITES

If you're using more than one test suite and want the coverage results to be merged, use Coveralls.wear_merged! instead of Coveralls.wear!.

Or, if you're using Coveralls alongside another SimpleCov formatter, simply omit the Coveralls formatter, then add the rake task coveralls:push to your Rakefile as a dependency to your testing task, like so:

require 'coveralls/rake/task'
Coveralls::RakeTask.new
task :test_with_coveralls => [:spec, :features, 'coveralls:push']

This will prevent Coveralls from sending coverage data after each individual suite, instead waiting until SimpleCov has merged the results, which are then posted to Coveralls.io.

Unless you've added coveralls:push to your default rake task, your build command will need to be updated on your CI to reflect this, for example:

bundle exec rake :test_with_coveralls

Read more about SimpleCov's result merging.

MANUAL BUILDS VIA CLI

coveralls-ruby also allows you to upload coverage data manually by running your test suite locally.

To do this with RSpec, just type bundle exec coveralls push in your project directory.

This will run RSpec and upload the coverage data to Coveralls.io as a one-off build, passing along any configuration options specified in .coveralls.yml.

coveralls-ruby's People

Contributors

afinetooth avatar anjin avatar chr0n1x avatar donokuda avatar drrb avatar elizabrock avatar envygeeks avatar ianheggie avatar junaruga avatar kbrock avatar lucianopc avatar mcelicalderon avatar mlarraz avatar nickmerwin avatar nikitaavvakumov avatar nucc avatar pengwynn avatar petergoldstein avatar phlipper avatar phoet avatar pietbrauer avatar piotrmurach avatar satoryu avatar sferik avatar smortex avatar steveklabnik avatar tagliala avatar wilg avatar y-yagi avatar zackkitzmiller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coveralls-ruby's Issues

Specs fail on the master branch + typo

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
$ git rev-parse --verify HEAD
be17fe9be3cb698185793fa59aedafaf07a13eea
$ rspec
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}
............................F............F....

Failures:

  1) Coveralls#push! sends existings test results
     Failure/Error: result.should be_truthy

       expected: truthy value
            got: false
     # ./spec/coveralls/coveralls_spec.rb:90:in `block (3 levels) in <top (required)>'

  2) Coveralls::SimpleCov::Formatter#format should run posts json
     Failure/Error: Coveralls::SimpleCov::Formatter.new.format(result).should be_truthy

       expected: truthy value
            got: false
     # ./spec/coveralls/simplecov_spec.rb:36:in `block (5 levels) in <top (required)>'
     # ./spec/spec_helper.rb:70:in `block in silence'
     # ./spec/spec_helper.rb:79:in `silence_stream'
     # ./spec/spec_helper.rb:69:in `silence'
     # ./spec/coveralls/simplecov_spec.rb:35:in `block (4 levels) in <top (required)>'

Finished in 0.73173 seconds (files took 0.36859 seconds to load)
46 examples, 2 failures

Failed examples:

rspec ./spec/coveralls/coveralls_spec.rb:85 # Coveralls#push! sends existings test results
rspec ./spec/coveralls/simplecov_spec.rb:33 # Coveralls::SimpleCov::Formatter#format should run posts json

Coverage report generated for RSpec to ./coverage. 287 / 316 LOC (90.82%) covered.

There is also a typo at https://github.com/lemurheavy/coveralls-ruby/blob/master/spec/coveralls/coveralls_spec.rb#L85, existings should be existing

undefined method `new' for Term:Module

My project https://github.com/seekshiva/courses has many models within. All tests were running fine. Just after I added coveralls gem and called coveralls.wear! from spec_helper.rb, the test started failing.

Test fails with the following error:

undefined method `new' for Term:Module

Why is this happening only for the Term model and not any of the other models? i tried googling, but couldn't find any good reason why this is happening.

Coveralls exception: RestClient::InternalServerError 500

hi, coveralls not work for me.

part of travis-ci log:

[Coveralls] Submiting with config:
{
"environment": {
"travis_job_id": "3822538",
"travis_pull_request": "false",
"pwd": "/home/travis/builds/kaize/itc73",
"rails_root": "/home/travis/builds/kaize/itc73",
"simplecov_root": "/home/travis/builds/kaize/itc73",
"gem_version": "0.5.5"
},
"git": {
"head": {
"id": "427df4d3566811c3d06f24f95eed9d72cead85ec",
"author_name": "_",
"author_email": "_
_",
"committer_name": "
__",
"committer_email": "
_**",
"message": "coveralls configuration"
},
"branch": "(no branch)",
"remotes": [
{
"name": "origin",
"url": "git://github.com/kaize/itc73.git"
}
]
},
"configuration": {
"repo_token": "qSjqRZPqsDzuHyUVeAzPaiv9udjmFLm9S",
"service_name": "travis-ci"
},
"repo_token": "qSjqRZPqsDzuHyUVeAzPaiv9udjmFLm9S",
"service_job_id": "3822538",
"service_name": "travis-ci"
}
[Coveralls] Submitting to https://coveralls.io/api/v1
Coveralls encountered an exception:
RestClient::InternalServerError
500 Internal Server Error

for more information look full travis build log: https://travis-ci.org/kaize/itc73

Circle CI w/ Parallel Tests

We've got our test suite running on Circle CI w/ 8 parallel containers. Is there any way to merge the results across containers? I see the documentation about merging test suite results, but that seems to be for one container running a single instance of your test suite, correct?

If not, is there some clarified documentation to get Coveralls set up out of the box with Circle CI parallelism?

That would be great!

Undisclosed dependency to VCR 2.x?

Getting this error on Travis:

Coveralls encountered an exception:
NoMethodError
undefined method `configure' for VCR:Module
/home/travis/.rvm/gems/ruby-1.9.3-p327/gems/coveralls-0.5.8/lib/coveralls/api.rb:38:in `disable_net_blockers!'

/home/travis/.rvm/gems/ruby-1.9.3-p327/gems/coveralls-0.5.8/lib/coveralls/api.rb:13:in `post_json'
/home/travis/.rvm/gems/ruby-1.9.3-p327/gems/coveralls-0.5.8/lib/coveralls/simplecov.rb:67:in `format'
/home/travis/.rvm/gems/ruby-1.9.3-p327/gems/simplecov-0.7.1/lib/simplecov/result.rb:91:in `format!'
/home/travis/.rvm/gems/ruby-1.9.3-p327/gems/simplecov-0.7.1/lib/simplecov/configuration.rb:133:in `block in at_exit'
/home/travis/.rvm/gems/ruby-1.9.3-p327/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52:in `call'
/home/travis/.rvm/gems/ruby-1.9.3-p327/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52:in `block in <top (required)>'

We're still using vcr 1.11.3 which predates the introduction of VCR.configure in 2.0.0: https://github.com/vcr/vcr/blob/master/CHANGELOG.md#deprecated

I'm sure we can upgrade but VCR scares the shit out of me so I'm a little hesitant. 😄

Where code coverage file will be created with this tool?

Hi

When I used this tool, I didn't know where coverage file will be created . The command line just shows :

[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's 'rails' settings.
DEPRECATION: Spec is deprecated. Use RSpec instead. Called from /home/roger/Pcf_Tracker/spec/support/features.rb:1:in `<top (required)>'.
***.

Pending:
ContainerPackage add some examples to (or delete) /home/roger/Pcf_Tracker/spec/models/container_package_spec.rb
# No reason given
# ./spec/models/container_package_spec.rb:4
Container add some examples to (or delete) /home/roger/Pcf_Tracker/spec/models/container_spec.rb
# No reason given
# ./spec/models/container_spec.rb:4
RepoPackage add some examples to (or delete) /home/roger/Pcf_Tracker/spec/models/repo_package_spec.rb
# No reason given
# ./spec/models/repo_package_spec.rb:5

Finished in 0.0552 seconds
4 examples, 0 failures, 3 pending

Randomized with seed 24953

[Coveralls] Outside the Travis environment, not sending data.

I am look forward to seeing some information about coverage,but no any traces.

Changelog is outdated

The latest version is 0.7.8, and neither the changelog file nor the gh releases are explaining the changes.
Could you please at least keep one updated?
Thanks :)
/cc @olivierlacan

Rails 5 / Invalid option --profile

I don't know if thats really an issue, but i can't find any workaround and it definitely comes from coveralls.

In our project we set up Coveralls to merge the results from cucumber and spec.

As described on the page we used this code within the Rakefile:

require 'coveralls/rake/task'
Coveralls::RakeTask.new
task :test_with_coveralls => [:spec, :cucumber, 'coveralls:push']

When test_with_coveralls is executed, i can see in the command line, that the following command is executed for cucumber:

/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -S bundle exec cucumber --profile default

which then leads to the following error:

/usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/test_unit/minitest_plugin.rb:57:in `plugin_rails_options': invalid option: --profile (OptionParser::InvalidOption)
        from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.9.0/lib/minitest.rb:200:in `block (2 levels) in process_args'
        from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.9.0/lib/minitest.rb:198:in `each'
        from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.9.0/lib/minitest.rb:198:in `block in process_args'
        from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.9.0/lib/minitest.rb:168:in `new'
        from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.9.0/lib/minitest.rb:168:in `process_args'
        from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.9.0/lib/minitest.rb:122:in `run'
        from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.9.0/lib/minitest.rb:62:in `block in autorun'

As far as i can recall, this only happens after our upgrade to Rails-5 (which may has to do with railties-5.0.0).

But somehow Coveralls adds this --profile default option to the end of the task, which causes this error.
Does anyone know how to avoid this?

Display test coverage after CLI run

Hi there,

after replacing simplecov with coveralls no test coverage is displayed anymore in the console. Is there a way to get that information back?

Plus I'd actually also like to still generate the good old HTML files to check them in development and not having to wait for the CI to run to see the test coverage.

Can this be achieved now or is it possible to implement with the current architecture?

Cheers and thanks for building this, looks good so far!
Tobi

Coveralls is looking into gem dependencies' code and reports they're not covered...

I've made a small gem (SmsSafe), and it currently has 100% code coverage (according to SimpleCov).

However, according to Coveralls, it only has 41% coverage (report here).

The reason for that difference seems to be that coveralls is taking the code from my gem's dependencies as part of my code, and complaining that those aren't covered...

I haven't seen it do this in any other gems I've looked into, and I haven't seen any special coveralls configuration in those gems' codebases...

The way I'm calling coveralls is by having this in my Rakefile:

require 'coveralls/rake/task'
Coveralls::RakeTask.new
task :test_with_coveralls => ["test", "coveralls:push"]

and by having Travis evecute "test_with_coveralls":

script: bundle exec rake test_with_coveralls

Which is the right way of adding it according to their docs

Any ideas why this might be happening?

Coveralls says things aren't covered by tests when they are

There are a number of examples in my open-source web app of things Coveralls says are not covered when they actually are. One of these examples (from build 894) is in the following code, where Coveralls (v. 0.7.1) is saying the internal code of the methods (but not the method names) is uncovered:

# /features/support/helpers.rb
# Debugging method for tasks
def dump_tasks
  puts "TASKS:"
  Task.all.each {|task| puts "#{task.to_hash}\n"}
end

# Debugging method for users
def dump_users
  puts "USERS:"
  User.all.each do |user|
    hash = user.to_hash
    hash[:username] = user.username
    hash[:password] = user.password
    puts "#{hash}\n"
  end
end

However, I have RSpec tests covering the functioning of these methods:

# /spec/test_helper_spec.rb
describe 'test helper methods' do 
  describe '::dump_users' do
    before(:each) do 
      FactoryGirl.create_list(:user, 3)
      @output = "USERS:\n"
      User.all.each do |user|
        hash = user.to_hash
        hash[:username], hash[:password] = user.username, user.password
        @output << "#{hash}\n"
      end
    end

    it 'lists all the user data' do 
      expect { dump_users }.to output(@output).to_stdout
    end
  end 

  describe '::dump_tasks' do 
    before(:each) do 
      FactoryGirl.create_list(:task, 3)
      @output = "TASKS:\n"
      Task.all.each {|task| @output << "#{task.to_hash}\n" }
    end

    it 'lists all the task data' do 
      expect { dump_tasks }.to output(@output).to_stdout
    end
  end
end

This is one of several basically identical situations that are coming up for my app (which still has very high coverage ratings). This example covers methods only used in my test suite, but there are others that include models, modules, etc. I'm not sure if I'm using Coveralls correctly or if this is a bug. I can give more examples if need be.

Issues with colorize dependency

The colorize and the colored gems monkey patch the String class methods with the same name which take different arguments. This leads to issues in gems which depend on the latter (like CocoaPods).

Test suite only runs from a git repo

If you attempt to run the test suite from e.g. the gem (where there's no local .git directory), the test suite throws a bunch of errors:

fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Coveralls git error:
undefined method `gsub' for nil:NilClass

Running it from a git clone works as expected.

VCR conflict

Should auto add the ignore_request to VCR config:

VCR.configure do |config|
  config.cassette_library_dir     = 'spec/data'
  config.default_cassette_options = { :record => :new_episodes }
  config.ignore_localhost         = true

  config.hook_into :webmock

  config.ignore_request do |request|
    request.uri =~ /coveralls/
  end
end

Implicit dependency on 'json' gem

Coveralls started causing the build to fail with the following stack trace after I started using Cucumber with Gherkin 2.11.7.

$ bundle exec rake
rake aborted!
no such file to load -- json
org/jruby/RubyKernel.java:1019:in `require'
/home/travis/.rvm/gems/jruby-1.7.3-d18/gems/coveralls-0.6.4/lib/coveralls/rake/task.rb:3:in `(root)'
org/jruby/RubyKernel.java:1019:in `require'
/home/travis/build/drrb/gitsu/Rakefile:1:in `(root)'
org/jruby/RubyKernel.java:1041:in `load'
/home/travis/build/drrb/gitsu/Rakefile:7:in `(root)'

Gherkin 2.11.6 depended on json, but 2.11.7 depends on multi_json. Coveralls appears to implicitly depend on json, and was working while it was being pulled in transitively through Cucumber. Adding 'json' as a dependency fixes the problem.

Coveralls not showing coverage.

Our travis runs look like they're submitting data to coveralls,

[Coveralls] Submitting to https://coveralls.io/api/v1
[Coveralls] Job #15778.1
[Coveralls] https://coveralls.io/jobs/9774785
Coverage is at 63.04%.
Coverage report sent to Coveralls.

but our coveralls page shows

COVERAGE REMAINED THE SAME AT ?%

Travis CI Fail But Local Push Success

In my test project for coveralls, I can use bundle exec coveralls push to generate and push my data correctly to coveralls(https://coveralls.io/jobs/3050588).

However, when I push a comment to Travis CI using the EXACTLY SAME source, I get the EXACTLY SAME result from CLI with EXACTLY SAME server response success message(https://travis-ci.org/vxst/rubytest/jobs/37665696), but the coverage is still unknown after a long time(https://coveralls.io/jobs/3050585).

coveralls 0.6.9 conflicts code which has `Term` class

Hi,

After upgrading coveralls 0.6.9, our app start to crash.
From this commit e4c0733 coveralls depends on term-ansicolor.
term-ansicolor takes Term namespace as Module, but our codebase has Term class.
It's conflict and we can't use coveralls anymore.

Please let me know the solution except rename our existent class..


minimum case sample code:

  • Gemfile
source 'https://rubygems.org'

gem 'coveralls'
  • Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:
    coveralls (0.6.9)
      multi_json (~> 1.3)
      rest-client
      simplecov (>= 0.7)
      term-ansicolor
      thor
    mime-types (1.25)
    multi_json (1.8.0)
    rest-client (1.6.7)
      mime-types (>= 1.16)
    simplecov (0.7.1)
      multi_json (~> 1.0)
      simplecov-html (~> 0.7.1)
    simplecov-html (0.7.1)
    term-ansicolor (1.2.2)
      tins (~> 0.8)
    thor (0.18.1)
    tins (0.9.0)

PLATFORMS
  ruby

DEPENDENCIES
  coveralls
  • app.rb
class Term
end

require 'coveralls'
  • shell output
$ ruby app.rb 
/Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/term-ansicolor-1.2.2/lib/term/ansicolor.rb:1:in `<top (required)>': Term is not a module (TypeError)
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/coveralls-0.6.9/lib/coveralls/output.rb:22:in `<module:Output>'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/coveralls-0.6.9/lib/coveralls/output.rb:21:in `<module:Coveralls>'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/coveralls-0.6.9/lib/coveralls/output.rb:1:in `<top (required)>'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/coveralls-0.6.9/lib/coveralls.rb:4:in `<top (required)>'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
        from /Users/kyanny/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
        from app.rb:4:in `<main>'

  • Ruby version
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]

Please loosen the thor dependency

Bundler could not find compatible versions for gem "thor":
  In Gemfile:
    pronto-rails_best_practices (= 0.3.0) ruby depends on
      pronto (~> 0.3.0) ruby depends on
        thor (~> 0.19.0) ruby

    coveralls (= 0.7.2) ruby depends on
      thor (0.18.1)

coveralls 0.7.1 works fine. Thanks.

warning: instance variable @track_files_glob not initialized

I get the following warning when I running my test suite:

/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simplecov-0.11.1/lib/simplecov.rb:56: warning: instance variable @track_files_glob not initialized

It seems like the Coveralls gem is missing to set some configuration on the simplecov gem. The track_files config in question was introduced to SimpleCov in this PR: simplecov-ruby/simplecov#422 just a few weeks ago.

Allow us to disable most of the noise.

It would be nice to be able to reduce:

[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
......

Finished in 0.06088 seconds
6 examples, 0 failures

[Coveralls] Outside the Travis environment, not sending data.
[Coveralls] Some handy coverage stats:
  * lib/depends.rb => 95%
  * lib/helpers.rb => 48%

to:

......

Finished in 0.06088 seconds
6 examples, 0 failures
Coverage stats:
  * lib/depends.rb => 95%
  * lib/helpers.rb => 48%

[Also, I realize some of it is noise from RSpec but it's left there to act as part of the example.]

TypeError when running guard-rspec's second pass, only occurs with Coveralls.wear!

I initially reported the issue at guard-rspec, please see the discussion there for additional information.

The problem only occurs on Windows (tested successfully on Ubuntu):

  1. guard-rspec is configured to run all on start
  2. spec_helper.rb calls Coveralls.wear!
  3. guard-rspec detects changed files and tries to run the specs against them
  4. a TypeError is raised
10:24:39 - ERROR - Guard::RSpec failed to achieve its <run_on_modifications>, exception was:
> [#] TypeError: no implicit conversion from nil to integer
> [#] C:/Ruby/lib/ruby/gems/2.0.0/gems/guard-rspec-4.2.9/lib/guard/rspec/runner.rb:40:in `system'
> [#] C:/Ruby/lib/ruby/gems/2.0.0/gems/guard-rspec-4.2.9/lib/guard/rspec/runner.rb:40:in `block in _run'
> [#] C:/Ruby/lib/ruby/gems/2.0.0/gems/guard-rspec-4.2.9/lib/guard/rspec/runner.rb:59:in `block in _without_bundler_env'
...

I traced it down to Coveralls.wear!, whenever I remove that line the second guard-rspec pass succeeds.

Begin using SemVer

I recently updated via the coveralls gem and I ran into an issue where your most recent changes meant that you no longer supported jruby because tins dropped support for jruby. I request that you switch to http://semver.org/ so that upstream projects can version accordingly so that this does not occur.

Thanks!

Coveralls triggers notifications before merging results from parallel CircleCI builds.

Given 100% test coverage across 10 parallel CircleCI containers, we're seeing Coveralls trigger the coverage notification when the first of the parallel builds finishes, so we get notifications saying that we only have ~10% coverage. As the other builds finish, Coveralls correctly merges the results in its UI to reflect 100% coverage, but it doesn't issue new notifications.

Is there a way to make Coveralls wait until it has all the results from a given CI build? The ability to specify an expected number of inbound coverage reports would be best, but even enabling a time delay would be better. The existing '10% coverage' notifications this issue creates make Coveralls unusable for our engineering team. (related to lemurheavy/coveralls-public#485)

Parallel coverage isn't working with CircleCI

I was excited to try #53 but it's not working for me yet. I have the following in my circle.yml:

  post:
    - bundle exec rake coveralls:push:
        parallel: true

This produces 4 outputs:

$ bundle exec rake coveralls:push
[Coveralls] Submitting with config:
{"environment":{"pwd":"/home/ubuntu/chewy","rails_root":"/home/ubuntu/chewy","simplecov_root":"/home/ubuntu/chewy","gem_version":"0.7.9","circleci_build_num":"2939","branch":"dan-circle-parallelism-323","commit_sha":"ee2721c7765f8fc1d83d36adc51c0c1954171cbe"},"git":{"head":{"id":"ee2721c7765f8fc1d83d36adc51c0c1954171cbe","author_name":"Dan Kohn","author_email":"[email protected]","committer_name":"Dan Kohn","committer_email":"[email protected]","message":"Use correct coveralls"},"branch":"dan-circle-parallelism-323","remotes":[{"name":"origin","url":"[email protected]:spreemo/chewy.git"}]},"repo_token": "[secure]","service_name":"circleci","service_number":"2939","service_pull_request":null,"parallel":true,"service_job_number":"0"}
[Coveralls] Submitting to https://coveralls.io/api/v1
[Coveralls] Job #2939.1
[Coveralls] https://coveralls.io/jobs/4302292
Coverage is at 86.25%.
Coverage report sent to Coveralls.
Coverage report generated for rails_app_10193, rails_app_10558, rails_app_10739, rails_app_7960, rails_app_8623 to /home/ubuntu/chewy/coverage. 2458 / 2850 LOC (86.25%) covered.
$ bundle exec rake coveralls:push
[Coveralls] Submitting with config:
{"environment":{"pwd":"/home/ubuntu/chewy","rails_root":"/home/ubuntu/chewy","simplecov_root":"/home/ubuntu/chewy","gem_version":"0.7.9","circleci_build_num":"2939","branch":"dan-circle-parallelism-323","commit_sha":"ee2721c7765f8fc1d83d36adc51c0c1954171cbe"},"git":{"head":{"id":"ee2721c7765f8fc1d83d36adc51c0c1954171cbe","author_name":"Dan Kohn","author_email":"[email protected]","committer_name":"Dan Kohn","committer_email":"[email protected]","message":"Use correct coveralls"},"branch":"dan-circle-parallelism-323","remotes":[{"name":"origin","url":"[email protected]:spreemo/chewy.git"}]},"repo_token": "[secure]","service_name":"circleci","service_number":"2939","service_pull_request":null,"parallel":true,"service_job_number":"1"}
[Coveralls] Submitting to https://coveralls.io/api/v1
[Coveralls] Job #2939.1
[Coveralls] https://coveralls.io/jobs/4302293
Coverage is at 86.53%.
Coverage report sent to Coveralls.
Coverage report generated for rails_app_10054, rails_app_10419, rails_app_10941, rails_app_7972, rails_app_8633 to /home/ubuntu/chewy/coverage. 2408 / 2783 LOC (86.53%) covered.

(and two more like that).

But on https://coveralls.io/r/spreemo/chewy I'm seeing 4 entries for build #2939, rather than seeing them aggregated. I'm open to other configurations, but using both RSpec and Cucumber tests, and I use simplecov HTML output. So, the rake task seemed like the simplest way to invoke coveralls.

My .simplecov is:

unless ENV['NO_COVERAGE']
  require 'English'
  SimpleCov.start 'rails' do
    command_name "rails_app_#{$PROCESS_ID}"
    merge_timeout 1200
    add_group 'ActiveAdmin', 'app/activeadmin'
    add_group 'Validators', 'app/validators'
    add_filter '/config/'
    add_filter '/features/'
    add_filter '/lib/assets'
    add_filter '/lib/tasks'
    add_filter '/spec/'
    add_filter '/vendor/'
  end
end

JSON output errors

Any idea why I'm getting this stuff at the end of a test run? Happens only in Development.

/Users/username/Development/dir/.bundle/gems/json-1.7.7/lib/json/common.rb:155:in `parse': 795: unexpected token at 'null, (MultiJson::LoadError)
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        0,
        null,
        0,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        null,
        null,
        1,
        1,
        1,
        1,
        null,
        1,
        1,
        1,
        null,
        null,
        1,
        1,
        1,
        null,
        null,
        null,
        1,
        1,
        1,
        null,
        1,
        0,
        0,
        0,
        0,
        null,
        null,
        null,
        1,
        1,
        1,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        1,
        null,
        null,
        1,
        1,
        1,
        1,
        null,
        null,
        null,
        1,
        1,
        0,
        0,
        0,
        null,
        null,
        null,
        1,
        null,
        0,
        null,
        null,
        null,
        1,
        1,
        0,
        0,
        0,
        null,
        null,
        null,
        1,
        null,
        0,
        null,
        null,
        null,
        1,
        1,
        null,
        0,
        null,
        null,
        1,
        null,
        0,
        null,
        null,
        null,
        1,
        1,
        null,
        0,
        null,
        null,
        1,
        null,
        0,
        null,
        null,
        1,
        0,
        null,
        0,
        null,
        null,
        null,
        1,
        1,
        0,
        0,
        0,
        null,
        null,
        null,
        1,
        1,
        0,
        null,
        null,
        1,
        0,
        0,
        0,
        null,
        null,
        null,
        null,
        1,
        1,
        1,
        null,
        1,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        1,
        null,
        null,
        1,
        1,
        null,
        1,
        null,
        1,
        0,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        1,
        1,
        null,
        1,
        null,
        1,
        null,
        1,
        0,
        0,
        null,
        null,
        null,
        null,
        1,
        1,
        1,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        0,
        null,
        null,
        null,
        0,
        null,
        null,
        null,
        0,
        null,
        null,
        null,
        null,
        null,
        1,
        1,
        1,
        0,
        0,
        null,
        null,
        null,
        null,
        null,
        1,
        null,
        1,
        0,
        0,
        null,
        null,
        1,
        1,
        1,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        1,
        null,
        1,
        0,
        0,
        0,
        null,
        null,
        1,
        0,
        null,
        0,
        0,
        0,
        0,
        null,
        null,
        null,
        null,
        1,
        1,
        1,
        null,
        1,
        0,
        null,
        null,
        null,
        null,
        1,
        1,
        1,
        1,
        null,
        1,
        0,
        null,
        null,
        null,
        1,
        1,
        1,
        null,
        1,
        0,
        null,
        null,
        null,
        null,
        1,
        1,
        1,
        null,
        1,
        1,
        null,
        1,
        0,
        0,
        null,
        null,
        1,
        0,
        0,
        null,
        null,
        1,
        0,
        0,
        null,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        1,
        1,
        null,
        1,
        0,
        null,
        0,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        1,
        null,
        1,
        0,
        0,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        1,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        0,
        0,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        1,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        0,
        0,
        null,
        null,
        null,
        null
      ],
      "/Users/username/Development/dir/spec/requests/client_authentication_spec.rb": [
        null,
        1,
        null,
        1,
        1,
        1,
        null,
        1,
        1,
        1,
        1,
        1,
        null,
        1,
        null,
        null,
        null,
        null,
        0,
        0,
        null,
        0,
        0,
        null,
        null,
        null,
        1,
        null,
        1,
        1,
        0,
        null,
        null,
        null,
        null,
        null,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        null,
        1,
        1,
        0,
        0,
        null,
        null,
        null,
        null,
        null,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        null,
        null,
        null
      ],
      "/Users/username/Development/dir/spec/services/course_access_policy/policy_spec.rb": [
        1,
        null,
        1,
        1,
        1,
        1,
        1,
        1,
        null,
        1,
        1,
        1,
        0,
        null,
        null,
        1,
        null,
        null,
        1,
        1,
        0,
        null,
        null,
        1,
        null,
        null,
        null,
        null
      ],
      "/Users/username/Development/dir/.bundle/gems/database_cleaner-0.9.1/lib/database_cleaner/active_record/transaction.rb": [
        1,
        1,
        null,
        1,
        1,
        1,
        1,
        null,
        1,
        0,
        0,
        null,
        0,
        null,
        0,
        null,
        null,
        null,
        1,
        0,
        null,
        0,
        null,
        0,
        0,
        null,
        0,
        null,
        null,
        null,
        null
      ],
      "/Users/username/Development/dir/.bundle/gems/database_cleaner-0.9.1/lib/database_cleaner/active_record/base.rb": [
        1,
        1,
        1,
        null,
        1,
        1,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        1,
        null,
        1,
        null,
        1,
        3,
        3,
        null,
        null,
        1,
        3,
        null,
        null,
        1,
        3,
        0,
        0,
        null,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        null,
        1,
        null,
        0,
        null,
        0,
        1,
        null,
        null,
        1,
        null,
        1,
        0,
        0,
        0,
        0,
        null,
        null,
        null,
        1,
        0,
        0,
        0,
        null,
        null,
        null,
        null,
        null
      ],
      "/Users/username/Development/dir/.bundle/gems/database_cleaner-0.9.1/lib/database_cleaner/generic/base.rb": [
        1,
        1,
        1,
        null,
        1,
        1,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        1,
        0,
        null,
        null,
        null,
        null,
        null
      ],
      "/Users/username/Development/dir/.bundle/gems/database_cleaner-0.9.1/lib/database_cleaner/generic/transaction.rb": [
        1,
        1,
        1,
        1,
        3,
        0,
        null,
        null,
        null,
        null,
        null
      ],
      "/Users/username/Development/dir/.bundle/gems/database_cleaner-0.9.1/lib/database_cleaner/active_record/truncation.rb": [
        1,
        null,
        1,
        null,
        1,
        1,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        1,
        null,
        1,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        null,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        0,
        null,
        null,
        null,
        null,
        1,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        0,
        null,
        null,
        1,
        null,
        null,
        1,
        0,
        null,
        null,
        null,
        null,
        null,
        null,
        1,
        0,
        0,
        null,
        null,
        null,
        null,
        null,
        0,
        null,
        null,
        null,
        1,
        0,
        null,
        null,
        null,
        null,
        1,
        1,
        0,
        null,
        null,
        null,
        null,
        1,
        1,
        0,
        0,
        null,
        1,
        null,
        null,
        1,
        1,
        0,
        0,
        0,
        0,
        null,
        null,
        null,
        null,
        1,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        0,
        null,
        null,
        1,
        0,
        0,
        null,
        null,
        1,
        null,
        null,
        null,
        null,
        null,
        1,
        0,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        null,
        1,
        1,
        0,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        null,
        null,
        null,
        1,
        0,
        0,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        null,
        1,
        1,
        null,
        null,
        null,
        null,
        null,
        null,
        1,
        1,
        1,
        1,
        null,
        1,
        1,
        0,
        0,
        0,
        null,
        0,
        null,
        null,
        null,
        null,
        1,
        null,
        1,
        0,
        null,
        null,
        null,
        1,
        1,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        0,
        null,
        null,
        null
      ],
      "/Users/username/Development/dir/.bundle/gems/database_cleaner-0.9.1/lib/database_cleaner/generic/truncation.rb": [
        1,
        1,
        1,
        1,
        1,
        0,
        null,
        1,
        0,
        null,
        null,
        1,
        1,
        1,
        1,
        1,
        null,
        null,
        1,
        null,
        null,
        null,
        1,
        0,
        null,
        null,
        1,
        1,
        0,
        null,
        null,
        null,
        null,
        1,
        0,
        null,
        null,
        null,
        null
      ]
    },
    "timestamp": 1365989087
  }
}
'
  from /Users/username/Development/dir/.bundle/gems/json-1.7.7/lib/json/common.rb:155:in `parse'
  from /Users/username/Development/dir/.bundle/gems/multi_json-1.7.2/lib/multi_json/adapters/json_common.rb:16:in `load'
  from /Users/username/Development/dir/.bundle/gems/multi_json-1.7.2/lib/multi_json/adapter.rb:19:in `load'
  from /Users/username/Development/dir/.bundle/gems/multi_json-1.7.2/lib/multi_json.rb:120:in `load'
  from /Users/username/Development/dir/.bundle/gems/simplecov-0.7.1/lib/simplecov/json.rb:8:in `parse'
  from /Users/username/Development/dir/.bundle/gems/simplecov-0.7.1/lib/simplecov/result_merger.rb:16:in `resultset'
  from /Users/username/Development/dir/.bundle/gems/simplecov-0.7.1/lib/simplecov/result_merger.rb:65:in `store_result'
  from /Users/username/Development/dir/.bundle/gems/simplecov-0.7.1/lib/simplecov.rb:48:in `result'
  from /Users/username/Development/dir/.bundle/gems/simplecov-0.7.1/lib/simplecov/configuration.rb:133:in `block in at_exit'
  from /Users/username/Development/dir/.bundle/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52:in `call'
  from /Users/username/Development/dir/.bundle/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52:in `block in <top (required)>'

Saving to filesystem and uploadng

I want simplecov to write results to the /coverage directory like always, in addition to sending it to coveralls.io.

I previously had:

require 'simplecov'
SimpleCov.start

Now I have:

require 'simplecov'
require 'coveralls'

SimpleCov.start
Coveralls.wear!('rails')

And it doesn't save to the local directory any more, other than .resultset.json and .last_run.json. How do I get it to both save and upload?

Thanks in advance.

Simplecov error when using merged results

I'm trying to set merge support up with one of my repositories, but (I assume) setting the formatter to nil is causing an error after cucumber has been run.

/Users/tom/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/simplecov-0.7.1/lib/simplecov/result.rb:91:in `format!': undefined method `new' for nil:NilClass (NoMethodError)
  from /Users/tom/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/simplecov-0.7.1/lib/simplecov/configuration.rb:133:in `block in at_exit'
    from /Users/tom/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52:in `call'
    from /Users/tom/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52:in `block in <top (required)>'
rake aborted!

At the top of both features/env.rb and spec/spec_helper.rb I have the coveralls load lines:

require 'coveralls'
Coveralls.wear_merged!('rails')

This is the rake task I am using, although I imagine that this is somewhat irrelevant:

require 'coveralls/rake/task'
Coveralls::RakeTask.new

namespace :ci do
  desc "Run tests on Travis."
  task :travis do
    puts "Starting to run cucumber..."
    system("bundle exec rake cucumber")
    raise "Cucumber failed!" unless $?.exitstatus == 0

    puts "Starting to run rspec..."
    system("export RSPEC=true && bundle exec rake spec")
    raise "RSpec failed!" unless $?.exitstatus == 0

    Rake::Task["coveralls:push"].invoke
  end
end

task travis: "ci:travis"

Using coveralls updater in a plugin style

I managed to use coveralls updater to send coverage for a bash project.

https://coveralls.io/github/albfan/git-ignore

coverage is obtained from a third party tool bashcov

https://github.com/infertux/bashcov

build on top of simplecov

https://github.com/colszowka/simplecov

I make this work modifying bashcov

albfan/bashcov@a6f4861

It would be desirable to add coveralls in a plugin way to bashcov, but I can't imagine how to do that.

For travis I assume that dependencies should be installed by hand

- before_install
    - gem install coveralls

But, How to add a coveralls formatter to a third party tool?

Restore Ruby 1.8.7 compatibility

Even though simplecov only works on Ruby >= 1.9, lots of gems depend on coveralls that still test again Ruby 1.8.

It looks like you’re using Ruby 1.9 (i.e. Ruby 1.8 incompatible) hash syntax on line 63 of lib/coveralls/api.rb.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.