Commit f403e299 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'chore/cobertura-rspec-jest-karme-report' into 'master'

Add GitLab Test Coverage Visualization to Karma, Jest and RSpec

See merge request gitlab-org/gitlab!27655
parents b6226a4f 2fb89d97
......@@ -159,6 +159,7 @@ karma:
- tmp/tests/frontend/
reports:
junit: junit_karma.xml
cobertura: coverage-javascript/cobertura-coverage.xml
karma-as-if-foss:
extends:
......@@ -226,6 +227,8 @@ coverage-frontend:
expire_in: 31d
paths:
- coverage-frontend/
reports:
cobertura: coverage-frontend/cobertura-coverage.xml
.qa-frontend-node:
extends:
......
......@@ -256,6 +256,8 @@ rspec:coverage:
- coverage/index.html
- coverage/assets/
- tmp/memory_test/
reports:
cobertura: coverage/coverage.xml
# EE/FOSS: default refs (MRs, master, schedules) jobs #
#######################################################
......
......@@ -371,6 +371,7 @@ group :development, :test do
gem 'scss_lint', '~> 0.56.0', require: false
gem 'haml_lint', '~> 0.34.0', require: false
gem 'simplecov', '~> 0.18.5', require: false
gem 'simplecov-cobertura', '~> 1.3.1', require: false
gem 'bundler-audit', '~> 0.6.1', require: false
gem 'benchmark-ips', '~> 2.3.0', require: false
......
......@@ -1021,6 +1021,8 @@ GEM
simplecov (0.18.5)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov-cobertura (1.3.1)
simplecov (~> 0.8)
simplecov-html (0.12.2)
sixarm_ruby_unaccent (1.2.0)
slack-messenger (2.3.3)
......@@ -1382,6 +1384,7 @@ DEPENDENCIES
sidekiq-cron (~> 1.0)
simple_po_parser (~> 1.1.2)
simplecov (~> 0.18.5)
simplecov-cobertura (~> 1.3.1)
slack-messenger (~> 2.3.3)
snowplow-tracker (~> 0.6.1)
spring (~> 2.0.0)
......
......@@ -181,7 +181,7 @@ module.exports = function(config) {
if (process.env.BABEL_ENV === 'coverage' || process.env.NODE_ENV === 'coverage') {
karmaConfig.reporters.push('coverage-istanbul');
karmaConfig.coverageIstanbulReporter = {
reports: ['html', 'text-summary'],
reports: ['html', 'text-summary', 'cobertura'],
dir: 'coverage-javascript/',
subdir: '.',
fixWebpackSourcePaths: true,
......
......@@ -26,6 +26,6 @@ reportFiles
const context = createContext({ coverageMap: coverageMap, dir: 'coverage-frontend' });
['json', 'lcov', 'text-summary', 'clover'].forEach(reporter => {
['json', 'lcov', 'text-summary', 'clover', 'cobertura'].forEach(reporter => {
create(reporter, {}).execute(context);
});
......@@ -2,6 +2,7 @@
require_relative '../spec/simplecov_env'
SimpleCovEnv.configure_profile
SimpleCovEnv.configure_formatter
module SimpleCov
module ResultMerger
......
# frozen_string_literal: true
require 'simplecov'
require 'simplecov-cobertura'
require 'active_support/core_ext/numeric/time'
require_relative '../lib/gitlab/utils'
......@@ -12,10 +13,19 @@ module SimpleCovEnv
configure_profile
configure_job
configure_formatter
SimpleCov.start
end
def configure_formatter
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::SimpleFormatter,
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::CoberturaFormatter
])
end
def configure_job
SimpleCov.configure do
if ENV['CI_JOB_NAME']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment