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

Incorrect results on Travis CI #360

Closed
michaelmior opened this issue Jan 19, 2015 · 11 comments
Closed

Incorrect results on Travis CI #360

michaelmior opened this issue Jan 19, 2015 · 11 comments
Labels

Comments

@michaelmior
Copy link

Locally I get ~83% coverage, but I only get ~52% on Travis CI. Perhaps it's not a SimpleCov bug, but hoping someone might have some ideas. Using SimpleCov 0.9.1. Ruby version is identical in both environments (ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]). Tests are run with RSpec 3.1.0. Any suggestions appreciated :)

@michaelmior
Copy link
Author

Strangely, I'd like to add that using the Code Climate gem seems to work directly despite the fact that it's using the same version of SimpleCov under the hood.

@bf4
Copy link
Collaborator

bf4 commented Jan 20, 2015

I can't really diagnose your problem without any code or more information, but it may be related to running parallel specs, the command you run the tests with locally vs. on ci, or your merge timeout, if any.

Please see #340 and report back.

@bf4 bf4 added the Support label Jan 20, 2015
@michaelmior
Copy link
Author

Sorry for the lack of details. Hopefully the points below help

  • This is not a Rails app
  • My command locally is the same as on Travis CI bundle exec rspec --tag ~disabled
  • I have no .simplecov file (however, I added one with my config from spec_helper.rb and this didn't change anything)
  • My tests are not run in parallel

@bf4
Copy link
Collaborator

bf4 commented Jan 21, 2015

Without more code there's really nothing I can do.

@sunnyrjuneja
Copy link

@michaelmior I had a similar problem with Circle CI. I think the problem might be that the gems are being installed in your apps directory and they're being added to simple cov report. I was able to resolve this using an add_filter "/vendor/" but if your directory is different, you might have the same problem.

@michaelmior
Copy link
Author

@whatasunnyday Thanks! That did the trick. I forgot that by default Travis configures bundler to install dependencies in vendor. Given how common the usage of Travis CI is these days, perhaps that's worth mentioning in the documentation somewhere.

@sunnyrjuneja
Copy link

@bf4 Would you be interested in a PR? I had the same problem today and spent 10 mins figuring it out.

@bf4
Copy link
Collaborator

bf4 commented Jan 27, 2015

Sure. I've had this problem in other situations as well when I forget that I've bundled gems in the current dir, like when I use bundle standalone ( add_filter 'bundle' ).

It looks like only the Rails profile excludes vendor/bundle by default I'm not sure why that would be.

@colszowka @sferik @xaviershay Any reason not to put these in the test_frameworks config? The commit that added it only to the Rails profile doesn't make me think otherwise.

Per travis docs

If you have custom Bundler arguments, and these include the --path option, Travis CI will use that path. If --path is missing but --deployment is present, it will use vendor/bundle.

Otherwise it will automatically add the --path option. In this case it will either use the value of the environment variable BUNDLE_PATH or, if it is missing, vendor/bundle.

(via the bash-fu --path=${BUNDLE_PATH:-vendor/bundle} that falls back to vendor/bundle if BUNDLE_PATH isn't set)

@xaviershay
Copy link
Collaborator

Sorry I missed your question when you first asked it. I was just bitten by this today. I'd support adding add_filter '/vendor/bundle/' to the appropriate default config.

@xaviershay
Copy link
Collaborator

For completeness:

Going to re-open this ticket.

@xaviershay xaviershay reopened this Mar 19, 2015
@sferik
Copy link
Collaborator

sferik commented Apr 19, 2015

I'd support adding add_filter '/vendor/bundle/' to the appropriate default config.

This has been added and released in version 0.10.0. Please reopen this issue if that doesn’t solve it for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants