File tree Expand file tree Collapse file tree 6 files changed +104
-2
lines changed Expand file tree Collapse file tree 6 files changed +104
-2
lines changed Original file line number Diff line number Diff line change 11.idea
22/Gemfile.lock
33/tmp /aruba
4+ /coverage
Original file line number Diff line number Diff line change 1+ # Copied from https://github.com/cucumber/aruba/blob/3b1a6cea6e3ba55370c3396eef0a955aeb40f287/.simplecov
2+ # Licensed under MIT - https://github.com/cucumber/aruba/blob/3b1a6cea6e3ba55370c3396eef0a955aeb40f287/LICENSE
3+
4+ SimpleCov . configure do
5+ enable_for_subprocesses true
6+
7+ # Activate branch coverage
8+ enable_coverage :branch
9+
10+ # ignore this file
11+ add_filter ".simplecov"
12+ add_filter "features"
13+
14+ # Rake tasks aren't tested with rspec
15+ add_filter "Rakefile"
16+ add_filter "lib/tasks"
17+
18+ #
19+ # Changed Files in Git Group
20+ # @see http://fredwu.me/post/35625566267/simplecov-test-coverage-for-changed-files-only
21+ untracked = `git ls-files --exclude-standard --others`
22+ unstaged = `git diff --name-only`
23+ staged = `git diff --name-only --cached`
24+ all = untracked + unstaged + staged
25+ changed_filenames = all . split ( "\n " )
26+
27+ add_group "Changed" do |source_file |
28+ changed_filenames . select do |changed_filename |
29+ source_file . filename . end_with? ( changed_filename )
30+ end
31+ end
32+
33+ add_group "Libraries" , "lib"
34+
35+ # Specs are reported on to ensure that all examples are being run and all
36+ # lets, befores, afters, etc are being used.
37+ add_group "Specs" , "spec/"
38+ end
Original file line number Diff line number Diff line change 11#!/usr/bin/env rake
2+ $LOAD_PATH << File . expand_path ( __dir__ )
3+
4+ require "aruba/platform"
5+
6+ require "bundler"
7+ Bundler . setup
8+
29require 'bundler/gem_tasks'
3- require 'rspec/core/rake_task'
10+ require "cucumber/rake/task"
11+ require "rspec/core/rake_task"
12+
13+ Cucumber ::Rake ::Task . new do |t |
14+ t . cucumber_opts = %w( --format progress )
15+ end
416
517RSpec ::Core ::RakeTask . new ( 'spec' )
618
7- task default : :spec
19+ desc "Run the whole test suite."
20+ task test : [ :spec , :cucumber ]
21+
22+ task default : :test
Original file line number Diff line number Diff line change @@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
2929 spec . add_development_dependency 'rspec' , '~> 3.7'
3030 spec . add_development_dependency 'cucumber' , '~> 8.0'
3131 spec . add_development_dependency 'aruba' , '~> 2.1'
32+ spec . add_development_dependency 'simplecov' , '~> 0.22.0'
3233end
Original file line number Diff line number Diff line change 1+ # Based on https://github.com/cucumber/aruba/blob/3b1a6cea6e3ba55370c3396eef0a955aeb40f287/features/support/env.rb
2+ # Licensed under MIT - https://github.com/cucumber/aruba/blob/3b1a6cea6e3ba55370c3396eef0a955aeb40f287/LICENSE
3+
4+ $LOAD_PATH. unshift File . expand_path ( '../../lib' , __dir__ )
5+
6+ # Has to be the first file required so that all other files show coverage information
7+ require_relative 'simplecov_support' unless RUBY_PLATFORM . include? ( 'java' )
8+
9+ require 'fileutils'
10+ require 'pathname'
11+
112require 'aruba/cucumber'
13+ require 'rspec/expectations'
14+
15+ Around do |test_case , block |
16+ command_name = "#{ test_case . location . file } :#{ test_case . location . line } # #{ test_case . name } "
17+
18+ # Used in simplecov_setup so that each scenario has a different name and
19+ # their coverage results are merged instead of overwriting each other as
20+ # 'Cucumber Features'
21+ set_environment_variable 'SIMPLECOV_COMMAND_NAME' , command_name . to_s
22+
23+ simplecov_setup_pathname =
24+ Pathname . new ( __FILE__ ) . expand_path . parent . to_s
25+
26+ # set environment variable so child processes will merge their coverage data
27+ # with parent process's coverage data.
28+ prepend_environment_variable 'RUBYOPT' , "-I#{ simplecov_setup_pathname } -rsimplecov_support "
29+
30+ with_environment do
31+ block . call
32+ end
33+ end
Original file line number Diff line number Diff line change 1+ # Copied from https://github.com/cucumber/aruba/blob/3b1a6cea6e3ba55370c3396eef0a955aeb40f287/features/support/simplecov_setup.rb
2+ # Licensed under MIT - https://github.com/cucumber/aruba/blob/3b1a6cea6e3ba55370c3396eef0a955aeb40f287/LICENSE
3+
4+ # @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for
5+ # child processes and @in-process
6+ unless RUBY_PLATFORM . include? ( 'java' )
7+ require 'simplecov'
8+ root = File . expand_path ( '../..' , __dir__ )
9+ command_name = ENV [ 'SIMPLECOV_COMMAND_NAME' ] || 'Cucumber Features'
10+ SimpleCov . command_name ( command_name )
11+ SimpleCov . root ( root )
12+
13+ # Run simplecov by default
14+ SimpleCov . start unless ENV . key? 'ARUBA_NO_COVERAGE'
15+ end
You can’t perform that action at this time.
0 commit comments