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

Empty XML report return no lines #295

Open
madest92 opened this issue Nov 17, 2022 · 0 comments
Open

Empty XML report return no lines #295

madest92 opened this issue Nov 17, 2022 · 0 comments

Comments

@madest92
Copy link
Contributor

If there are no tests in the project(coberture file is empty), then diff-cover does not see the changes.
I have added new code. And expect coverage difference to be 0.

# git diff origin/master
....
+
+// ToUpper stub. 
+func (i *Implementation) ToUpper(ctx context.Context, req *desc.StringRequest) (*desc.StringResponse, error) {
+    if (req.S=="a") {
+        return nil, nil
+    }
+    return &desc.StringResponse{S: strings.ToUpper(req.S)}, nil
+}

# cat cover.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage line-rate="NaN" branch-rate="0" version="" timestamp="1668675986513" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0" complexity="0">
  <sources></sources>
  <packages></packages>
</coverage>

But I'm getting:

# diff-cover cover.xml --compare-branch origin/master
-------------
Diff Coverage
Diff: origin/master...HEAD, staged and unstaged changes
-------------
No lines with coverage information in this diff.
-------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant