Debian Codegraph @

rspec-core/script/rspec_with_simplecov

raw
1 #!/usr/bin/env ruby
2
3 # Turn on verbose to make sure we not generating any ruby warning
4 $VERBOSE = true
5
6 # So our "did they run the rspec command?" detection logic thinks
7 # that we run `rspec`.
8 $0 = "rspec"
9
10 # For the monorepo build the bundle directory is at the top level
11 $:.unshift File.expand_path '../../../bundle', __FILE__
12
13 require 'bundler/setup'
14
15 # To use simplecov while running rspec-core's test suite, we must
16 # load simplecov _before_ loading any of rspec-core's files.
17 # So, this executable exists purely as a wrapper script that
18 # first loads simplecov, and then loads rspec.
19 begin
20 # Simplecov emits some ruby warnings when loaded, so silence them.
21 old_verbose, $VERBOSE = $VERBOSE, false
22
23 unless ENV['NO_COVERAGE'] || RUBY_VERSION.to_f < 2.1
24 require 'simplecov'
25
26 SimpleCov.start do
27 root File.expand_path("../..", __FILE__)
28 add_filter %r{/bundle/}
29 add_filter %r{/tmp/}
30 add_filter %r{/spec/}
31 minimum_coverage(100)
32 end
33 end
34 rescue LoadError # rubocop:disable Lint/SuppressedException
35 ensure
36 $VERBOSE = old_verbose
37 end
38
39 load File.expand_path("../../exe/rspec", __FILE__)