|
| 1 | += JaCoCo XML to HTML in PowerShell |
| 2 | +:toc: |
| 3 | +:toclevels: |
| 4 | + |
| 5 | +== Support this tool |
| 6 | + |
| 7 | +link:https://ko-fi.com/E1E3VQUK2[image:https://ko-fi.com/img/githubbutton_sm.svg[Ko-fi]] |
| 8 | + |
| 9 | +== Description |
| 10 | + |
| 11 | +JaCoCo (Java Code Coverage) XML to HTML converter written in PowerShell. |
| 12 | + |
| 13 | +JaCoCo is a popular code coverage format used by several languages and tools, including PowerShell's Pester testing |
| 14 | +framework. |
| 15 | + |
| 16 | +The best thing about this tool is - it's all PowerShell. You don't need to have Java or any other tool installed in |
| 17 | +order to generate an HTML report. |
| 18 | + |
| 19 | +== Showcase |
| 20 | + |
| 21 | +image::doc/statistics.png[alt="statistics preview"] |
| 22 | +image::doc/code.png[alt="code coverage preview"] |
| 23 | + |
| 24 | +=== Key features |
| 25 | + |
| 26 | +* Pure PowerShell without dependencies |
| 27 | +* Code coverage statistics per group, package and source file |
| 28 | +* Source code coverage with colored lines, automatic source code language detection and syntax highlighting |
| 29 | +* All supported statistics are covered: instructions, branches, lines, complexity, methods and classes |
| 30 | +* Dark and light themes |
| 31 | +* Support for custom themes (Bootstrap or your own custom CSS) |
| 32 | +* Simple, but rich, well documented configuration (config file) with minimum mandatory fields - exactly 3: XML file, |
| 33 | +source code directory and HTML destination directory. The rest are pure customization options. |
| 34 | +* Easy integration with Pester |
| 35 | +* Mozilla Public License 2.0 (free and open source) |
| 36 | + |
| 37 | +== Installation |
| 38 | + |
| 39 | +=== Prerequisites |
| 40 | + |
| 41 | +* Microsoft PowerShell 7 (link:https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows[Installation instructions]) |
| 42 | +* For running Pester tests see the link:doc/testing.adoc[Testing guide] |
| 43 | + |
| 44 | +=== Installation |
| 45 | + |
| 46 | +Clone the repository: |
| 47 | + |
| 48 | +[source,shell] |
| 49 | +---- |
| 50 | +git clone https://github.com/constup/JaCoCoXML-to-HTML-PowerShell . |
| 51 | +---- |
| 52 | + |
| 53 | +or download and unpack a release from link:https://github.com/constup/JaCoCoXML-to-HTML-PowerShell/releases[Releases page] |
| 54 | + |
| 55 | +== How to use |
| 56 | + |
| 57 | +=== Configuration |
| 58 | + |
| 59 | +In order to use this tool, you will need a configuration file. A commented-out configuration file |
| 60 | +(link:config.ps1.dist[config.ps1.dist]) is provided, so you can just copy it to your project and run JaCoCo-XML-To-HTML. |
| 61 | +Just remember to remove the `.dist` extension. |
| 62 | + |
| 63 | +Mandatory configuration options are: |
| 64 | + |
| 65 | +* `xml_file`: the coverage report XML file; |
| 66 | +* `destination_directory`: where you want to save the HTML report. This directory must be empty. The directory will be |
| 67 | +created if it does not exist; |
| 68 | +* `sources_directory`: root directory where your project's source code is (usually `src/` directory in your project) |
| 69 | + |
| 70 | +The rest of the configuration options are optional. Their description and documentation is available on the |
| 71 | +link:doc/configuration.adoc[Configuration] page. |
| 72 | + |
| 73 | +=== Running |
| 74 | + |
| 75 | +Once you have a configuration file with mandatory properties filled, everything is done by calling one command: |
| 76 | + |
| 77 | +[source,shell] |
| 78 | +---- |
| 79 | +pwsh .\constup-jacoco-xml-to-html.ps1 --config /path/to/your/configuration/file |
| 80 | +---- |
| 81 | + |
| 82 | +=== Themes and customization |
| 83 | + |
| 84 | +By default, JaCoCo XML to HTML will create an HTML with a light theme. To generate a report with a dark theme, set the |
| 85 | +theme in your configuration file: |
| 86 | + |
| 87 | +[source,powershell] |
| 88 | +---- |
| 89 | +'theme' = 'dark'; |
| 90 | +---- |
| 91 | + |
| 92 | +More theme and customization options are available on the link:doc/configuration.adoc[Configuration] page. |
| 93 | + |
| 94 | +== More documentation |
| 95 | + |
| 96 | +The following documentation is also available: |
| 97 | + |
| 98 | +* link:doc/configuration.adoc[Configuration] - Additional configuration, themes and customization options |
| 99 | +* link:doc/test-tools-integration.adoc[Test Tools Integration] - How to integrate this tool with testing tools |
| 100 | +* link:doc/testing.adoc[Testing] - Unit testing with Pester |
| 101 | + |
| 102 | +== 3rd party software licenses |
| 103 | + |
| 104 | +This project uses and is bundled with the following 3rd party software: |
| 105 | + |
| 106 | +* link:https://getbootstrap.com[Bootstrap v5.3] - Copyright (c) 2011-2025 The Bootstrap Authors |
| 107 | +** link:https://github.com/twbs/bootstrap/blob/main/LICENSE[MIT License] (official repository) |
| 108 | +** link:assets/bootstrap/LICENSE[MIT License] (bundled with this project) |
| 109 | +* link:https://highlightjs.org[HighlightJS v11.11] - Copyright (c) 2006, Ivan Sagalaev |
| 110 | +** link:https://github.com/highlightjs/highlight.js/blob/main/LICENSE[BSD 3-Clause License] (official repository) |
| 111 | +** link:assets/highlightjs/LICENSE[BSD 3-Clause License] (bundled with this project) |
| 112 | +* link:https://github.com/wcoder/highlightjs-line-numbers.js[HighlightJS Line Numbers plugin v2.9] - Copyright (c) 2017 Yauheni Pakala |
| 113 | +** link:https://github.com/wcoder/highlightjs-line-numbers.js/blob/master/LICENSE[MIT License] (official repository) |
| 114 | +** link:assets/highlightjs/LICENSE[MIT License] (bundled with this project) |
| 115 | + |
| 116 | +== Support |
| 117 | + |
| 118 | +If you like this tool or find it useful, consider buying me a nice cup of coffee. Coffee fuels open source. |
| 119 | + |
| 120 | +link:https://ko-fi.com/E1E3VQUK2[image:https://ko-fi.com/img/githubbutton_sm.svg[Ko-fi]] |
| 121 | + |
| 122 | +== License |
| 123 | + |
| 124 | +link:LICENSE[Mozilla Public License 2.0] (also available on Mozilla's website at: |
| 125 | +https://www.mozilla.org/en-US/MPL/2.0/[MPL 2.0]) |
0 commit comments