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

Fix SimpleCov integration #933

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
# Used in simplecov_setup so that each scenario has a different name and
# their coverage results are merged instead of overwriting each other as
# 'Cucumber Features'
ENV["SIMPLECOV_COMMAND_NAME"] = command_name.to_s
set_environment_variable "SIMPLECOV_COMMAND_NAME", command_name.to_s

simplecov_setup_pathname =
Pathname.new(__FILE__).expand_path.parent.join("simplecov_setup")

# set environment variable so child processes will merge their coverage data
# with parent process's coverage data.
ENV["RUBYOPT"] = "-r#{simplecov_setup_pathname} #{ENV['RUBYOPT']}"
prepend_environment_variable "RUBYOPT", "-r#{simplecov_setup_pathname} "
end
21 changes: 19 additions & 2 deletions features/support/simplecov_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,30 @@

# @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for
# child processes and @in-process
#
# Current implementation slows down things immensely:
#
# On main:
# bin/cucumber --format progress 192.97s user 34.46s system 79% cpu 4:47.10 total
#
# On fix-simplecov-integration: with SimpleFormatter
# bin/cucumber --format progress 581.96s user 75.12s system 91% cpu 12:00.38 total
#
# On fix-simplecov-integration: with DumbFormatter
# bin/cucumber --format progress 732.04s user 105.59s system 92% cpu 15:05.49 total
#
unless RUBY_PLATFORM.include?("java")
require "simplecov"
root = File.expand_path("../..", __dir__)
command_name = ENV["SIMPLECOV_COMMAND_NAME"] || "Cucumber Features"
SimpleCov.command_name(command_name)
SimpleCov.root(root)

if (command_name = ENV["SIMPLECOV_COMMAND_NAME"])
SimpleCov.command_name(command_name)
SimpleCov.formatter SimpleCov::Formatter::SimpleFormatter
else
SimpleCov.command_name "Cucumber Features"
end

# Run simplecov by default
SimpleCov.start unless ENV.key? "ARUBA_NO_COVERAGE"
end
17 changes: 0 additions & 17 deletions fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb

This file was deleted.

Loading