File: rspec_with_simplecov

package info (click to toggle)
ruby-rspec 3.13.2c6e5m8s7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,724 kB
  • sloc: ruby: 71,961; sh: 127; makefile: 98
file content (39 lines) | stat: -rwxr-xr-x 1,133 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env ruby

# Turn on verbose to make sure we not generating any ruby warning
$VERBOSE = true

# So our "did they run the rspec command?" detection logic thinks
# that we run `rspec`.
$0 = "rspec"

# For the monorepo build the bundle directory is at the top level
$:.unshift File.expand_path '../../../bundle', __FILE__

require 'bundler/setup'

# To use simplecov while running rspec-core's test suite, we must
# load simplecov _before_ loading any of rspec-core's files.
# So, this executable exists purely as a wrapper script that
# first loads simplecov, and then loads rspec.
begin
  # Simplecov emits some ruby warnings when loaded, so silence them.
  old_verbose, $VERBOSE = $VERBOSE, false

  unless ENV['NO_COVERAGE'] || RUBY_VERSION.to_f < 2.1
    require 'simplecov'

    SimpleCov.start do
      root File.expand_path("../..", __FILE__)
      add_filter %r{/bundle/}
      add_filter %r{/tmp/}
      add_filter %r{/spec/}
      minimum_coverage(100)
    end
  end
rescue LoadError # rubocop:disable Lint/SuppressedException
ensure
  $VERBOSE = old_verbose
end

load File.expand_path("../../exe/rspec", __FILE__)