Git Product home page Git Product logo

cobertura-merge's People

Contributors

aarnott avatar andreaswachs avatar borremosch avatar dependabot[bot] avatar jrr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cobertura-merge's Issues

Error on Node v20 LTS

Error: The module '\\?\C:\Git\projects\fiyu\frontend\node_modules\node-expat\build\Release\node_expat.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 108. This version of Node.js requires
NODE_MODULE_VERSION 115. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1473:18)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at bindings (C:\Git\projects\fiyu\frontend\node_modules\bindings\bindings.js:112:48)
    at Object.<anonymous> (C:\Git\projects\fiyu\frontend\node_modules\node-expat\lib\node-expat.js:4:34)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
Error: Command failed: npx cobertura-merge -o merged-cobertura-coverage.xml ui=libs-ui-ct-cobertura-coverage.xml ui=libs-ui-cobertura-coverage.xml ui=apps-ui-e2e-cobertura-coverage.xml showcase=apps-showcase-e2e-cobertura-coverage.xml showcase=apps-showcase-cobertura-coverage.xml
node --version
v20.10.0

@borremosch can we get support for node v20

Error: Could not locate the bindings file.

I added cobertura-merge as dev dependency and executed it. I immediately get the following error:

cobertura-merge -o coverage/merged-coverage-reports.xml --package1=coverage/apps/shop/reservations/cobertura-coverage.xml --package2=coverage/apps/shop/main/cobertura-coverage.xml

/home/marco/projects/webshop/node_modules/bindings/bindings.js:126
err = new Error(
^
Error: Could not locate the bindings file. Tried:
→ /home/marco/projects/webshop/node_modules/node-expat/build/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/build/Debug/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/build/Release/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/out/Debug/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/Debug/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/out/Release/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/Release/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/build/default/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/compiled/18.16.0/linux/x64/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/addon-build/release/install-root/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/addon-build/debug/install-root/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/addon-build/default/install-root/node_expat.node
→ /home/marco/projects/webshop/node_modules/node-expat/lib/binding/node-v108-linux-x64/node_expat.node
at bindings (/home/marco/projects/webshop/node_modules/bindings/bindings.js:126:9)
at Object. (/home/marco/projects/webshop/node_modules/node-expat/lib/node-expat.js:4:34)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object. (/home/marco/projects/webshop/node_modules/xml2json/lib/xml2json.js:1:13)
at Module._compile (node:internal/modules/cjs/loader:1254:14)

But echo 'console.log(require("bindings"))' | node returns

[Function: bindings] {
  getFileName: [Function: getFileName],
  getRoot: [Function: getRoot]
}

I tried removing the node_modules folder and then re-installing as suggested in node-gyp#1511 but that doesn't help.

Environment:

  • Yarn 3.6.0
  • Node 18.16.0 (default) / 16.20.0 / 20.2.0
  • Ubuntu 22.04.2 (WSL 2)

-p for --print is displaying help, but --print works.

After installing the required packages in a node:14-debian-slim docker image, I get the following two outputs, one using -p and the other using --print:

root@5d3d4bd9f06f:~# cobertura-merge -p package1=output1.xml package2=output2.xml
Version 1.0.3
Syntax:    cobertura-merge [options]... [package=input...]

Examples:  cobertura-merge -o output.xml package1=output1.xml package2=output2.xml
           cobertura-merge -p package1=output1.xml package2=output2.xml

Options
-o FILE         Specify output file
-p, --print     print coverage report summary
root@5d3d4bd9f06f:~# cobertura-merge --print package1=output1.xml package2=output2.xml
Total line Coverage: 0.00%
Total branch Coverage: 0.00%
Total average Coverage: 0.00%

Adding explicit license

Hi Borre.

Would you consider adding a license to your project? And if so, which one would you add, in that case?

I'd love to use it at work in a Continuous Integration pipeline. We have strict requirements to control all code made by 3rd parties, and without a license, I'm not in the legal OK to fork your repo and use it at work.

Merge falls over if package is blank

I have a converge report that contains the following entry:

<package name="Snapshot.Contract" line-rate="1" branch-rate="1" complexity="0">
      <classes />
    </package>

When cobertura-mrge tries to process this I get an error:

cobertura-merge\src\merge.ts:9
return classes.map(jsonClass => ({
^
TypeError: Cannot read property 'map' of undefined

Should be simple to fix. This just needs a null check

Update README

Very nice package.
One suggestion for the README file.
You could mention the package1, package2 etc. are not hardcoded and required and any name can be used instead. I wanted to change them (as they appeared as is in the output) and reading the code I realized they are not hardcoded and you dont depend on that naming.

Thank you.

can't install in windows

in windows it try for some reason to locate python package then fail
full error

yarn install cobertura-merge    
yarn install v1.22.19
error `install` has been replaced with `add` to add new dependencies. Run "yarn add cobertura-merge" instead.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
PS C:\Users\aa.risaac\repos\Dashboard> yarn add cobertura-merge -D 
yarn add v1.22.19
[1/4] Resolving packages...
warning cobertura-merge > xml2json > [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and securi
ty patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning cobertura-merge > xml2json > [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and securi
ty patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning cobertura-merge > xml2json > joi > [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and 
security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning cobertura-merge > xml2json > joi > [email protected]: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
warning cobertura-merge > xml2json > joi > topo > [email protected]: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security iss
ues.
[2/4] Fetching packages...
warning Pattern ["object-assign@latest"] is trying to unpack in the same destination "C:\\Users\\aa.risaac\\AppData\\Local\\Yarn\\Cache\\v6\\npm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863-integrity\\node_module
s\\object-assign" as pattern ["object-assign@^4","object-assign@^4.0.1","object-assign@^4.1.1","object-assign@^4.1.1"]. This could result in non-deterministic behavior, skipping.
[3/4] Linking dependencies...
warning " > [email protected]" has incorrect peer dependency "@angular/common@>=7.0.0 <=13.0.0 || ^13.0.0".
warning " > [email protected]" has incorrect peer dependency "@angular/core@>=7.0.0 <=13.0.0 || ^13.0.0".
warning "@angular-devkit/build-angular > [email protected]" has incorrect peer dependency "webpack@^5.72.1".
warning " > @angular-eslint/[email protected]" has incorrect peer dependency "@angular/cli@>= 13.0.0 < 14.0.0".
warning " > @cypress/[email protected]" has unmet peer dependency "@babel/core@^7.0.1".
warning " > @cypress/[email protected]" has unmet peer dependency "@babel/preset-env@^7.0.0".
warning " > @cypress/[email protected]" has unmet peer dependency "babel-loader@^8.0.2".
warning " > [email protected]" has unmet peer dependency "mocha@>=3.1.2".
warning " > [email protected]" has unmet peer dependency "mocha@>=7".
[4/4] Building fresh packages...
error C:\Users\aa.risaac\repos\Dashboard\node_modules\node-expat: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: C:\Users\aa.risaac\repos\Dashboard\node_modules\node-expat
Output:
C:\Users\aa.risaac\repos\Dashboard\node_modules\node-expat>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "
" rebuild )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\Users\aa.risaac\AppData\Local\Programs\Python\Python39\python.exe
gyp ERR! find Python - "C:\Users\aa.risaac\AppData\Local\Programs\Python\Python39\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\aa.risaac\AppData\Local\Programs\Python\Python39-32\python.exe
gyp ERR! find Python - "C:\Users\aa.risaac\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\aa.risaac\AppData\Local\Programs\Python\Python38\python.exe
gyp ERR! find Python - "C:\Users\aa.risaac\AppData\Local\Programs\Python\Python38\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\aa.risaac\AppData\Local\Programs\Python\Python38-32\python.exe
gyp ERR! find Python - "C:\Users\aa.risaac\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\aa.risaac\AppData\Local\Programs\Python\Python37\python.exe
gyp ERR! find Python - "C:\Users\aa.risaac\AppData\Local\Programs\Python\Python37\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe
gyp ERR! find Python - "C:\Program Files\Python37\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\aa.risaac\AppData\Local\Programs\Python\Python37-32\python.exe
gyp ERR! find Python - "C:\Users\aa.risaac\AppData\Local\Programs\Python\Python37-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe
gyp ERR! find Python - "C:\Program Files\Python37-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe
gyp ERR! find Python - "C:\Program Files (x86)\Python37-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\aa.risaac\AppData\Local\Programs\Python\Python36\python.exe
gyp ERR! find Python - "C:\Users\aa.risaac\AppData\Local\Programs\Python\Python36\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe
gyp ERR! find Python - "C:\Program Files\Python36\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\aa.risaac\AppData\Local\Programs\Python\Python36-32\python.exe
gyp ERR! find Python - "C:\Users\aa.risaac\AppData\Local\Programs\Python\Python36-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe
gyp ERR! find Python - "C:\Program Files\Python36-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe
gyp ERR! find Python - "C:\Program Files (x86)\Python36-32\python.exe" could not be run
gyp ERR! find Python checking if the py launcher can be used to find Python 3
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (C:\Users\aa.risaac\AppData\Roaming\nvm\v18.16.0\node_modules\npm\node_modules\node-gyp\lib\find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (C:\Users\aa.risaac\AppData\Roaming\nvm\v18.16.0\node_modules\npm\node_modules\node-gyp\lib\find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\aa.risaac\AppData\Roaming\nvm\v18.16.0\node_modules\npm\node_modules\node-gyp\lib\find-python.js:228:18)
gyp ERR! stack     at PythonFinder.execFileCallback (C:\Users\aa.risaac\AppData\Roaming\nvm\v18.16.0\node_modules\npm\node_modules\node-gyp\lib\find-python.js:294:16)
gyp ERR! stack     at exithandler (node:child_process:427:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:439:5)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:289:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:476:16)
gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\aa.risaac\repos\Dashboard\node_modules\node-expat
gyp ERR! node -v v18.16.0
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Cannot read property 'map' of undefined

> npx cobertura-merge -o output.xml package1=coverage_production/client/cobertura-coverage.xml package2=coverage_production/server/cobertura-coverage.xml

Cannot read property 'map' of undefined

Doesn't give a stack trace weirdly enough!

html-escaped characters are unescaped during merge

(Version 0.3.1)

For some reason we have some < and > characters in class names in our C# coverage report. These are escaped as &lt; and &gt; so that the XML can remain valid:

<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="0.5486" branch-rate="0.4" version="1.9" timestamp="1588622196" lines-covered="282" lines-valid="514" branches-covered="12" branches-valid="30">
  <sources>
    <source>/Users/jrr/repos/example/</source>
  </sources>
  <packages>
    <package name="example.server" line-rate="0.5679" branch-rate="0.4285" complexity="55">
      <classes>
        <class name="example.server.Services.FakeAuthenticator/&lt;TryAuthenticate&gt;d__0" filename="example.server/Services/FakeAuthenticator.cs" line-rate="0" branch-rate="0" complexity="2">
          <methods>
            <method name="MoveNext" signature="()" line-rate="0" branch-rate="0">
              <lines>
                <line number="16" hits="0" branch="False" />
                <line number="17" hits="0" branch="True" condition-coverage="0% (0/2)">
                  <conditions>
                    <condition number="150" type="jump" coverage="0%" />
                  </conditions>
                </line>
                <line number="18" hits="0" branch="False" />
              </lines>
            </method>
          </methods>
          <lines>
            <line number="16" hits="0" branch="False" />
            <line number="17" hits="0" branch="True" condition-coverage="0% (0/2)">
              <conditions>
                <condition number="150" type="jump" coverage="0%" />
              </conditions>
            </line>
            <line number="18" hits="0" branch="False" />
          </lines>
        </class>
      </classes>
    </package>
  </packages>
</coverage>

(this is produced with a command like dotnet test --logger trx /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=cobertura)

When run through cobertura-merge, the characters get turned back into < and >, which is invalid XML:

jrr@jrrmbp ~/d/2020.05.04-cobertura-merge-issue>
yarn cobertura-merge -o out.xml package1=coverage.cobertura.xml
yarn run v1.22.4
warning package.json: No license field
$ /Users/jrr/datedwork/2020.05.04-cobertura-merge-issue/node_modules/.bin/cobertura-merge -o out.xml package1=coverage.cobertura.xml
✨  Done in 0.14s.
jrr@jrrmbp ~/d/2020.05.04-cobertura-merge-issue> xmllint --format out.xml
out.xml:2: parser error : Unescaped '<' not allowed in attributes values
complexity="55"><classes><class name="example.server.Services.FakeAuthenticator/
                                                                               ^
out.xml:2: parser error : attributes construct error
complexity="55"><classes><class name="example.server.Services.FakeAuthenticator/
                                                                               ^
out.xml:2: parser error : Couldn't find end of Start Tag class line 2
complexity="55"><classes><class name="example.server.Services.FakeAuthenticator/
                                                                               ^
out.xml:2: parser error : Opening and ending tag mismatch: TryAuthenticate line 2 and class
></conditions></line><line number="18" hits="0" branch="False"/></lines></class>

Sources got wrong in the new merged file

I got 4 cobertura XML files and want to merge them in one in order to upload to Sonar cloud.

Using cobertura-merge, the sources tag got messed and the previous sources are not there anymore. It makes the Sonar analyser to fail.

Is there a way to maintain the sources configuration?

The command 'cobertura-merge' is not recognized

I recently installed the latest version of cobertura-merge package (0.4.0).
npm install cobertura-merge

cobertura-merge -o output.xml package1=input1.xml package2=input2.xml

When I try to run cobertura-merge command I receive the following message:

The term 'cobertura-merge' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

What am I doing wrong or is it just a bug?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.