codeclimate / ruby-test-reporter

DEPRECATED Uploads Ruby test coverage data to Code Climate
https://codeclimate.com
Other
92 stars 92 forks source link

Required .git for tests #191

Closed ilgrad closed 7 years ago

ilgrad commented 7 years ago

rpm spec file Part with run tests:

%check
pushd .%{gem_instdir}
  tar xzf %{SOURCE1}
  sed -i '/bundler/ s/^/#/' spec/spec_helper.rb
  git init
  rspec -Ilib spec
  rm -rf spec
popd 

Error after mock build:

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.BHytsA
+ umask 022
+ cd /builddir/build/BUILD
~/build/BUILD/codeclimate-test-reporter-1.0.8/usr/share/gems/gems/codeclimate-test-reporter-1.0.8 ~/build/BUILD/codeclimate-test-reporter-1.0.8
+ cd codeclimate-test-reporter-1.0.8
+ pushd ./usr/share/gems/gems/codeclimate-test-reporter-1.0.8
+ tar xzf /builddir/build/SOURCES/codeclimate-test-reporter-1.0.8-specs.tar.gz
+ sed -i '/bundler/ s/^/#/' spec/spec_helper.rb
+ git init
Initialized empty Git repository in /builddir/build/BUILD/codeclimate-test-reporter-1.0.8/usr/share/gems/gems/codeclimate-test-reporter-1.0.8/.git/
+ rspec -Ilib spec
.............fatal: your current branch 'master' does not have any commits yet
fatal: your current branch 'master' does not have any commits yet
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: your current branch 'master' does not have any commits yet
fatal: your current branch 'master' does not have any commits yet
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
F.....fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
....fatal: your current branch 'master' does not have any commits yet
fatal: your current branch 'master' does not have any commits yet
......................

Failures:

  1) CodeClimate::TestReporter::Git.info returns a hash with git information.
     Failure/Error: expect(Git.info).to include expected_git_hash

       expected {:head => nil, :committed_at => nil, :branch => "HEAD"} to include {:head => "", :committed_at => 0}
       Diff:
       @@ -1,4 +1,4 @@
        :branch => "HEAD",
       -:committed_at => 0,
       -:head => "",
       +:committed_at => nil,
       +:head => nil,
     # ./spec/code_climate/test_reporter/git_spec.rb:13:in `block (3 levels) in <module:TestReporter>'

Finished in 0.25752 seconds (files took 0.36288 seconds to load)
45 examples, 1 failure

Failed examples:

rspec ./spec/code_climate/test_reporter/git_spec.rb:6 # CodeClimate::TestReporter::Git.info returns a hash with git information.

Coverage report generated for RSpec to /builddir/build/BUILD/codeclimate-test-reporter-1.0.8/usr/share/gems/gems/codeclimate-test-reporter-1.0.8/coverage. 569 / 635 LOC (89.61%) covered.
error: Bad exit status from /var/tmp/rpm-tmp.BHytsA (%check)
    Bad exit status from /var/tmp/rpm-tmp.BHytsA (%check)
maxjacobson commented 7 years ago

Hi @ilgrad, thanks for stopping by.

What is the context where you want to run this repo's test suite without its .git directory?

ilgrad commented 7 years ago

Hi @maxjacobson. If I run tests without

git init

tests requires .git. In tests should be no dependency the git repository

maxjacobson commented 7 years ago

Hm, I agree in the abstract, but I'm curious to learn more about the scenario where you're running the tests without the git repository. For us, we're usually running the tests locally and on Circle CI, both of which have access to the git repository.

Also: now that our new, unified test reporter is in beta, we're prioritizing updates to that rather than this ruby-only test reporter. If you're interested in improving our test suite here, I'm happy to review a PR, but it's not a high priority for us right now.

Thanks!