jacoco-html-asset-bundle

Make jacoco HTML standalone without requiring image files outside

Usage no npm install needed!

<script type="module">
  import jacocoHtmlAssetBundle from 'https://cdn.skypack.dev/jacoco-html-asset-bundle';
</script>

README

jacoco-html-asset-bundle

Bundle and embed image files and CSS files into HTML files so that they will be displayed properly on some context like Azure DevOps Pipelines.

Why?

You would need this, for example, when you are working with Azure DevOps Pipelines and wanna upload your coverage files provided by jacoco-gradle-plugin.

Even if your test coverage files are generated properly, HTML files would NOT be displayed properly on Azure DevOps Pipelines page because of security concern controlled by their side: Loading external resources inside iframe seems not allowed.

What does this package do?

jacoco-html-asset-bundle embeds all the images and CSS files to HTML files who requires those images and CSS.

For example, given

<img src="../jacoco-resources/redbar.gif" width="8" height="10" title="6" alt="6"/>

then

jacoco-html-asset-bundle \
    -d jacocoHtml \
    -r jacocoHtml/jacoco-resources
    -o output \

it will be like

<img src="data:image/gif;base64,R0lGODlhAQAKAOMKAP8PD/8dHf8sLP9KSv9dXf99ff+MjP+goP+mpv+srACtAACtAACtAACtAACtAACtACH5BAEKAA8ALAAAAAABAAoAAAQIMIxyEjJEgAgAOw==" width="8" height="10" title="6" alt="6"/>

so that this HTML file can be displayed without external assets.

Getting started

npm install -g jacoco-html-asset-bundle

jacoco-html-asset-bundle --help