Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bcbd1910
Commit
bcbd1910
authored
Aug 13, 2020
by
Erick Bajao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore sources node from cobertura XML
parent
5e8394b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
0 deletions
+42
-0
changelogs/unreleased/eb-skip-cobertura-sources.yml
changelogs/unreleased/eb-skip-cobertura-sources.yml
+5
-0
lib/gitlab/ci/parsers/coverage/cobertura.rb
lib/gitlab/ci/parsers/coverage/cobertura.rb
+2
-0
spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb
spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb
+35
-0
No files found.
changelogs/unreleased/eb-skip-cobertura-sources.yml
0 → 100644
View file @
bcbd1910
---
title
:
Ignore the sources node from the cobertura XML
merge_request
:
39385
author
:
type
:
fixed
lib/gitlab/ci/parsers/coverage/cobertura.rb
View file @
bcbd1910
...
...
@@ -28,6 +28,8 @@ module Gitlab
end
def
parse_node
(
key
,
value
,
coverage_report
)
return
if
key
==
'sources'
if
key
==
'class'
Array
.
wrap
(
value
).
each
do
|
item
|
parse_class
(
item
,
coverage_report
)
...
...
spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb
View file @
bcbd1910
...
...
@@ -19,6 +19,41 @@ RSpec.describe Gitlab::Ci::Parsers::Coverage::Cobertura do
end
end
context
'when there is a <sources>'
do
shared_examples_for
'ignoring sources'
do
it
'parses XML without errors'
do
expect
{
subject
}.
not_to
raise_error
expect
(
coverage_report
.
files
).
to
eq
({})
end
end
context
'and has a single source'
do
let
(
:cobertura
)
do
<<-
EOF
.
strip_heredoc
<sources>
<source>project/src</source>
</sources>
EOF
end
it_behaves_like
'ignoring sources'
end
context
'and has multiple sources'
do
let
(
:cobertura
)
do
<<-
EOF
.
strip_heredoc
<sources>
<source>project/src/foo</source>
<source>project/src/bar</source>
</sources>
EOF
end
it_behaves_like
'ignoring sources'
end
end
context
'when there is a single <class>'
do
context
'with no lines'
do
let
(
:cobertura
)
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment